在Matlab中将表面/线添加到3D干线图中

时间:2016-06-03 19:31:08

标签: matlab plot matlab-figure surface stem

说我有一个使用stem3的3D干线图

stem3(xx,yy,zz,'red')

enter image description here

我想在550(zz = 550)的高度添加一条线或半透明表面。有没有办法做到这一点?

1 个答案:

答案 0 :(得分:1)

您只需使用普通的surf对象即可完成此操作。

% Create your stem3 object
stem3(rand(10), rand(10), rand(10) * 700, 'r');

hold on

% Get the current X and Y Limits of the axes
xdata = get(gca, 'xlim');
ydata = get(gca, 'ylim');

% Ensure that the axes limimts don't change when we plot the surface
axis manual

% Create a surface that spans the axes and is of height 550 (the third input)
% Use alpha value of 0.1 for the face transparency
surf(xdata, ydata, 550 * ones(2), 'FaceAlpha', 0.1, 'FaceColor', 'red');

enter image description here