Labels of contour3 plot hide behind surface plot

10 views (last 30 days)
Hi, i got some issues with labeling the contourlines on a surface plot. Plotting the attached data leads to a nice surf plot with contour lines. But unfortunately the labels of the contour3 plot hide behind the surface plot. Setting 'FaceAlpha' of the surf plot to 0 shows the labels. But I would like to see the surface and all labels of the contour3 plot. What am i missing? Can someone please help!
Thanks a lot!
if true
% load test data
load('PlotData.mat');
% new figure & axes
f = figure;
ax = axes(f);
set(f,'Renderer','openGL');
hold(ax,'on');
% surf plot
surfPlot = surf(ax,X,Y,Z);
% surf options
surfPlot.FaceColor = 'interp';
surfPlot.LineStyle = 'none';
surfPlot.FaceAlpha = 1;
% Zmax for Zlim (inc 0.1)
maxZint = max(max(Z))*10;
maxZ = ceil(maxZint)/10;
% contour3 plot
[C,h] = contour3(ax,X,Y,Z,[0:0.1:maxZ 0:0.1:maxZ],'k','ShowText','on','LineWidth',1);
% labels on contour3
clabel(C,h,'FontSize',11,'Color',[0 0 0]);
% view
view(ax,[-37.5 30]);
end

Accepted Answer

Jan Scheuermann
Jan Scheuermann on 6 Jul 2018
I got the perfect answer from Ol1v3r in the german gomatlab forum. just wanted to share with you ...
if true
ax.SortMethod = 'childorder';
end

More Answers (0)

Products


Release

R2017b

Community Treasure Hunt

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

Start Hunting!