Extending the curtain plot (reference plane) when 3D plotting with meshz

조회 수: 2 (최근 30일)
Hi all,
I am using to meshz to display a 3D plot, but the curtain only extends to the extrema of the data points. In this particular case, the curtain falls inconveniently above the height 0.
Is it possible to drop the curtain to a specified height, namely 0? If so, how?
-Thanks,
Hussain

채택된 답변

the cyclist
the cyclist 2011년 8월 23일
The values you want are stored in the "ZData" property of the plot. So, you need to grab those data, modify them, and set them again. The code below is something like what you need, although I am not 100% I understood whether you wanted to cut off below or above zero, so you might need to adjust things.
oldZData = get(get(gca,'Children'),'ZData')
newZData = min(0,oldZData);
set(get(gca,'Children'),'ZData',newZData)
EDIT IN RESPONSE TO COMMENT:
oldZData = get(get(gca,'Children'),'ZData');
newZData = oldZData;
newZData(min(oldZData(:))==oldZData) = 0;
set(get(gca,'Children'),'ZData',newZData)
  댓글 수: 3
the cyclist
the cyclist 2011년 8월 24일
OK. I think I understand. I have added some different code to my answer, that I think does what you want. It identifies the points that are at the bottom of the current curtain, replaces those points with zeros, and redraws the new curtain.
Hussain
Hussain 2011년 8월 24일
Thanks! Your suggestion mostly solves the problem; it certainly pulls the curtain down to zero as I had hoped. However, by setting the minimum data point (or any data point for that matter) to zero, the presented data also has a false 0.
I managed to solve the problem in sort of a one-time-use-be-very-careful way by examining the meshz routine. The original programmer conveniently marked where the position of the curtain is defined, zref, as the minimum of a the finite z matrix. I made a modified copy of the routine in which zref = 0, which does the trick very cleanly in this case.
Thanks for your help! Your answer motivated my investigation into the meshz routine.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by