Problem with surf plot shading - equal z values displayed as different colours
Show older comments
Hi,
I am generating a surface plot (MATLAB version 9.13) of some X,Y,Z data (example data stored in the attached mat file) and have noticed that the colours of the surface plot indicate different values of Z at points where Z has the same value. Please see the attached picture where two example (x,y) points, both corresponding to a z value of 2.356, are shaded in different yellow colours.
This plot was generated by:
figure
f1 = surf(X,Y,Z);
colorbar
view([0,90])
datatip(f1,X(2),Y(16));
datatip(f1,X(42),Y(16));
I would expect the shading to appear as in this scaled colour image:
figure
f2 = imagesc(Z);
colorbar
datatip(f2,2,16);
datatip(f2,42,16);
I would appreciate your help in understanding why I am seeing this discrepancy in the shading of the surface plot.
Many thanks,
Fiona
Accepted Answer
More Answers (0)
Categories
Find more on Surface and Mesh Plots 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!
