Visibility of a simple 'plot' on tip of a 'surface'

2 次查看(过去 30 天)
I have a surface and am going to put a simple plot (which is a line connecting a few dots) on top of the surface. How can I do that?
I draw the surface and use 'hold on', and then draw the simple plot, but the simple plot goes behind the surface...

回答(1 个)

Walter Roberson
Walter Roberson 2014-3-21
Give the plot a slightly larger z value than the surface. Well, not exactly z value, really, but a coordinate which is slightly closer along the viewing angle than the surface itself is.
When you have a line and a surface at the same distance along the projection, then if you are in OpenGL (not unlikely for surface plots) then OpenGL has its own ideas of which should be drawn first, and nothing you can do by using uistack() can alter what OpenGL will do. So you separate them slightly so that one is "closer".

类别

Help CenterFile Exchange 中查找有关 Surface and Mesh Plots 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by