Clear Filters
Clear Filters

How can I compare plots with matlab?

4 views (last 30 days)
Hello again. I have 3 plots which I have included (1.jpg). I want to compare them, evaluate their difference and draw a conclusion. The order in which I want to compare those 3 plots is (from left to right)the first with the second and the second with the third. So far, I have tried to extract data from the plots and plot the difference. It has worked for the second and third plot. The problem is that in the second and third plot I have bathymetry (brown color) so I cannot implement that method to compare the first with the second. I have made a search and found something about plot subtraction but 'till now no success. My goal here is to visualize the difference from those comparisons (qualitative approach). Thanks in advance!
  3 Comments
Image Analyst
Image Analyst on 22 May 2016
What form is the data in? Is it actually an image? Or did it start as something else and then you turned it into an image?
How do other people in your field do the comparison? Surely you're not the first person ever to want to compare bathymetry data, so what have others published regarding comparison?
Paschalis Garouniatis
Paschalis Garouniatis on 22 May 2016
Well there is no data at first. I have environmental files which are processed by a program which produces a shade files. Those 3 plots are 3 shade files. Normally they are around 7MB each and there is a limitation of 5MB (here). So, I made the image with these 3 plots. About the comparison. Normally I would try a quantitative approach to do the comparison. But I tried to visualize each comparison through a difference plot. I extracted the data in the second comparison (as described above) in matrix form and visualized it. I will include it (it is from other shade files though).

Sign in to comment.

Accepted Answer

Chad Greene
Chad Greene on 22 May 2016
Set the bathymetry values to NaN in all three datasets. You'll have to make a mask of NaN values. In datasets 2 and 3, is bathymetry represented by a specific pixel value? If so, set all corresponding values in dataset 1 to NaN by
data1(data2==pixelvalue) = NaN;
where pixelvalue is whatever value represents baythymetry in datasets 2 and 3.
However, it looks like plots 2 and 3 were made by setting bathymetry to brown using patch or fill? If so, use the vertices that were used to plot the bathymetry can be used to define a polygon, then find all pixels in that polygon using inpolygon. That would look something like this:
[X,Z] = meshgrid(-100:xspacing:100,0:zspacing:4000);
bathymetry = inpolygon(X,Z,bathyx,bathyz);
data1(bathymetry) = NaN;
data2(bathymetry) = NaN;
data2(bathymetry) = NaN;
  2 Comments
Paschalis Garouniatis
Paschalis Garouniatis on 22 May 2016
Chad thanks a lot for your answer. When I extracted the data from the plots, all bathymetry values where set equal to 740 and I set them as NaNs. You can see it in the image above (blank bathymetry). Bathymetry is plotted after I plot the shade file ( I use the hold on and hold off commands).I will try what you suggested.
Paschalis Garouniatis
Paschalis Garouniatis on 27 May 2016
I set the pixel values of the bathymetry as NaN by using what you suggested above and it worked. In order to visualize the bathymetry after the comparison I used the matlab code which was provided by the program and everything is alright. Thanks again.

Sign in to comment.

More Answers (0)

Categories

Find more on MATLAB in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!