Matlab-冲浪和轮廓3,剪切顺序? [英] Matlab - surf and contour3, clipping order?

查看:77
本文介绍了Matlab-冲浪和轮廓3,剪切顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将数据绘制为Matlab中的曲面.我有三个数据矩阵,x,y,z. z的值可能不在0〜1的范围内.

I am plotting data as a surface in matlab. I have three data matrices, x,y,z. The values of z may not be outside the range 0~1.

我使用以下方法生成图:

I generate plots with the following:

surf(x,y,z);
[c,h] = contour3(x,y,z,'LevelList',[0 : 0.1 : 1],'Color','k');
clabel(c,h,[0 : 0.1 : 1]);

我还对表面进行了一些修改,例如设置shading interp.

I also do some modifications to the surface, such as setting shading interp.

如您所见,结果图像将轮廓与下面的曲面一起剪切.如何确保轮廓和标签绘制在表面上方?

As you can see, the result image clips the contours with the underlying surface. How can I ensure that the contour and labels are plotted above the surface?

推荐答案

在对文档进行一些挖掘之后,我找到了最佳解决方案.

After some digging in the doc, I have found the best solution.

剪切顺序在axes级别上指定.

The clipping order is specified at the axes level.

下面是轮廓始终位于表面顶部的完整MWE:

A complete MWE to have the contours always on top of the surface is below:

fig = figure;
ax = get(gca);
ax.SortMethod = 'childorder'; % this is the important line
surf(x,y,z);
[c,h] = contour3(x,y,z,'LevelList',[0 : 0.1 : 1],'Color','k');
clabel(c,h,[0 : 0.1 : 1]);

这篇关于Matlab-冲浪和轮廓3,剪切顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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