Remove specific contours or make them invisible
이전 댓글 표시
Hi,
I am creating a contour plot with contours at different levels.
How can I programmatically turn off certain contours or make them invisible. All outer contours that do not have an inner contour should be invisible or deleted from the plot.
For example in this case I create contours around -6 and -3. I want to remove the left contour at -3.
Thanks.
[X,Y,Z] = peaks(1000);
figure(1),hold on
view(2);
colorbar('vert');
s = surf(X,Y,Z,'Facealpha',0.75,'Edgecolor','none');
% threshold = -0.3*max(Z,[],'all');
threshold1 = [-6, -6];
threshold2 = [-3, -3];
[c1,h1] = contour(X,Y,Z,[threshold1 threshold1],'-k','Linewidth',5);
[c2,h2] = contour(X,Y,Z,[threshold2 threshold2],'-k','Linewidth',5);
hold off

채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!