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

2 ビュー (過去 30 日間)
Hussain
Hussain 2011 年 8 月 23 日
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 Center および File ExchangeGraphics Performance についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by