在MATLAB中将线对象放在顶部 [英] Put line object on top in MATLAB

查看:1013
本文介绍了在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?

:这是一张图片(三角形的中间还有更多点):

Here's a picture (There are also more points in the middle of the triangle):

推荐答案

在这种情况下,需要检查一些事情.很抱歉重复您已经尝试过的任何事情.

There are a few things to check in this situation. Sorry for repeating anything that you've already tried.

  1. 确保已设置hold on,以便您实际上在绘制两个数据集.

  1. 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') 设置(gcf,'renderer','painters') 设置(gcf,'renderer','zbuffer')

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, '.')

plot3(xdata, ydata, zdata, '.', 'markersize', 50)

如果这是2D图(从您的编辑中可以看到),则可以使用第三维来强制正确的顺序.实际上所有2D项目都以3D绘制,Z = 0.因此,如果您希望标记在表面上方绘制,则可以替换:

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')

使用

plot3(xdata, ydata, 0.1, 'o')

在Matlab和相关的图形系统中,表面和线条被认为是非常不同的项目.订购这些不同种类的物品有时需要一些帮助.

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.

这篇关于在MATLAB中将线对象放在顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆