Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to raise one 'box' up or down by 0.5?

1 回表示 (過去 30 日間)
A
A 2015 年 10 月 19 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hi everyone,
I have a simple question. If I have a simple surface plot (surf(peaks)), then is it possible for me to 'raise' or 'push down' each individual 'grid boxes' up or down by a certain amount of z?
Thank you

回答 (1 件)

Walter Roberson
Walter Roberson 2015 年 10 月 20 日
z = peaks;
idx1 = some list of locations
z(idx1) = z(idx1) - 0.5;
idx2 = some other list of locations
z(idx2) = z(idx2) + 0.5;
  7 件のコメント
Walter Roberson
Walter Roberson 2015 年 10 月 21 日
If you want a grid box to be raised in a disconnected manner, then you cannot use surf() and instead will need to use patch().
You could construct the sections independently, tracing along the edges of the contiguous regions.
Or you can take advantage of the fact that seconds will not be drawn if you use NaN as the corresponding value or coordinate, and so construct a grid structure with NaN in the place you want to cut out and then construct an additional region for where you want to be raised.
Now that I think of it, you could get away with using three surf(). The main surf would have nan for the Z values of the places you want to cut out. Then "hold on" and draw a second surf that has a higher Z for the places you want raised and NaN everywhere else, and then a third surf that has a lower Z for the places you want recessed and NaN everywhere else.
A
A 2015 年 10 月 21 日
I like your third idea. Would you be able to help me with it? How can I assign NaN to above mentioned values?

この質問は閉じられています。

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by