How can I label contour lines in meshc 3D-plot?

조회 수: 5 (최근 30일)
Ibrahim Wasiq
Ibrahim Wasiq 2017년 2월 28일
댓글: Ibrahim Wasiq 2017년 3월 2일
I have made a 3D-plot using meshc. I want to add labels to the contour lines. The handle return by the meshc is
h =
2x1 graphics array:
Surface
Contour
So I have tried to edit the properties using following command but it didn't work.
h.ShowText='on';
What is the right way to do it? Thanks
  댓글 수: 1
Ibrahim Wasiq
Ibrahim Wasiq 2017년 3월 2일
I used the following code to adjust the height of contour plot above/below the mesh plot and adding labels to contour plot.
h=meshc(peaks)
hContour=h(2);
hContour.ContourZLevel=-15; %Default (-10)
hContour.ShowText='on'; %Default ('off')
hContour.LevelStep=2.5; %Default (2.0)

댓글을 달려면 로그인하십시오.

채택된 답변

Star Strider
Star Strider 2017년 2월 28일
I would use a separate call to contour. You may have to experiment with the approach in Yair Altman’s Undocumented MATLAB article Customizing contour plots part 2 to put the contour plot on the same plane as the contours drawn by the meshc function.
When you get your code working, consider generalising your code to a function and then contribute it to the File Exchange. It seems useful.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by