本文介绍了Matlab的如何在z轴改变contourf地块的位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个三维表面,我的身影冲浪(X,Y,Z)

I have a 3d surface in my figure surf(x,y,z)

我也有一个 contourf 表面(这基本上是一个二维平面)。

I also have a contourf surface (which is basically a 2D plane).

我绘制它们在同一个数字,但对 contourf 剧情自动为 Z = 0 的水平。我想了 contourf 剧情移至 Z = -10 (或Z轴的任意值),但我T做到这一点。

I plot them in the same figure but the contourf plot is automatically at z=0 level. I want to move the contourf plot to z=-10 (or any value on z-axis) but I can't do it.

我相信这是容易的,但我无法找到在MATLAB帮助/谷歌的答案。任何想法?

I am sure it is easy but I can't find the answer in MATLAB help/Google.Any ideas?

推荐答案

请看下面的例子:

%# plot surface and contour
Z = peaks;
surf(Z), hold on
[~,h] = contourf(Z);       %# get handle to contourgroup object

%# change the ZData property of the inner patches
hh = get(h,'Children');    %# get handles to patch objects
for i=1:numel(hh)
    zdata = ones(size( get(hh(i),'XData') ));
    set(hh(i), 'ZData',-10*zdata)
end

这篇关于Matlab的如何在z轴改变contourf地块的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-14 20:31