0

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.

Community
  • 1
  • 1
  • Have you tried `clabel` http://www.mathworks.com/help/matlab/ref/clabel.html instead of the `'ShowText'` property? – Noel Segura Meraz Feb 15 '16 at 11:50
  • thanks for your hint - `clabel` adds the option to label only selected levels but the problem with the partially disappearing numbers remains the same – SteellessStain Feb 15 '16 at 12:24

1 Answers1

0

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

Noel Segura Meraz
  • 2,265
  • 1
  • 12
  • 17