0
votes

I would like to plot a contour or contour3 with labeled levels over a surf plot with the same data using Matlab R2015b. Finally the figure is shown from above (the view in negative z-direction) to see the result.

My problem: The labels seem to disappear in the surf area - the product lacks the intended information.

My current test-code with the best result so far:

[X,Y,Z] = peaks;
v = -6:2:8;
hold on
surf(X,Y,Z)
shading interp
contour3(X,Y,Z,v,'k--','ShowText','on')
hold off
colormap default
caxis([-7,9])
view(0,90)

I am not yet allowed to post a picture of the result ..

Related questions in my consideration would be how to change contourf plots location on z-axis or shift the z-value of contour plot in Matlab 2014b to change the z-axis-property of a normal contour plot but they were no solution to my problem or did not work at all.

1
Have you tried clabel mathworks.com/help/matlab/ref/clabel.html instead of the 'ShowText' property?Noel Segura Meraz
thanks for your hint - clabel adds the option to label only selected levels but the problem with the partially disappearing numbers remains the sameSteellessStain

1 Answers

0
votes

I finally understood your problem, you can solve it by doing all in 2D like so

[X,Y,Z] = peaks;
v = -6:2:8;
hold on
contourf(x,y,z,500,'LineStyle','none');
[C,h]=contour(x,y,z,v,'k--');
clabel(C,h,'FontSize',15);
caxis([-7,9])
view(0,90)

enter image description here