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 中查找有关 2-D and 3-D Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by