在 MATLAB 中将线对象放在顶部
我有一个彩色等值线图,它是从一组数据位置插值得到的。我想在等值线图顶部显示数据位置。由于某种原因,当我将它们绘制在一起时,彩色等高线图总是会覆盖数据位置。我先绘制哪一个并不重要。
这是为什么呢?如何强制将数据点绘制在顶部?
编辑:这是一张图片(三角形中间还有更多点):
I have a colored contour plot which is interpolated from a set of data locations. I would like to show the data locations on top of the contour plot. For some reason, the colored contour plot always covers up the data locations when I plot them together. It does not matter which one I plot first.
Why is this? And how can I force the data points to be plotted on top?
EDIT: Here's a picture (There are also more points in the middle of the triangle):
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,有几件事需要检查。很抱歉重复您已经尝试过的任何内容。
确保已设置
hold on
,以便您实际绘制两个数据集。尝试不同的可用渲染器。也就是说,一次尝试以下操作。
set(gcf,'渲染器','opengl')
设置(gcf,'渲染器','画家')
设置(gcf,'渲染器','zbuffer')
请注意,这些渲染选项之间还存在其他交易。例如,我怀疑“画家”可能提供最好的渲染,但更新速度会非常慢,并且几乎不可能(例如)旋转。
这有点遥远,但尝试简单地让你的标记更大。即替换
plot3(xdata, ydata, xdata, '.')
与
plot3(xdata, ydata, zdata, '.', 'markersize', 50)
绘图(xdata,ydata,'o')
与
plot3(xdata, ydata, 0.1, 'o')
在 Matlab 和中间图形系统中,表面和线被认为是非常不同的项目。订购这些不同类型的物品有时需要一些帮助。
There are a few things to check in this situation. Sorry for repeating anything that you've already tried.
Make sure that
hold on
has been set, so that you are actually plotting both datasets.Try the different renderers available. That is, try the following, one at a time.
set(gcf,'renderer','opengl')
set(gcf,'renderer','painters')
set(gcf,'renderer','zbuffer')
Note that there are other trades between these rendering options. For example, I suspect that 'painters' may provide the best render, but it will be very slow to update, and nearly impossible to (for example) rotate.
This is kind of a long shot, but try simply making your markers bigger. That is, replace
plot3(xdata, ydata, xdata, '.')
with
plot3(xdata, ydata, zdata, '.', 'markersize', 50)
If this is a 2D plot (I see from your edit that it is), then you can use the third dimension to force the correct order. All 2D items are actually plotted in 3D, with Z=0. Therefore if you want your markers to plot above the surface, you can replace:
plot(xdata, ydata, 'o')
with
plot3(xdata, ydata, 0.1, 'o')
Surfaces and lines are considered very different items b Matlab and the interlying graphics system. Ordering these different sorts of items sometimes requires a bit of help.