[英]Crossed stem plot in Matlab
I would like to reproduce in Matlab a plot that looks like this: 我想在Matlab中重现一个看起来像这样的情节:
The stem3 plot command sounds nice but only for the vertical stems. stem3 plot命令听起来不错,但仅适用于垂直茎。 Not the second series with the horizontal ones.
不是水平的第二个系列。
Everything would be easy if I could plot using the usual commands and rotate the result. 如果我可以使用常用命令进行绘图并旋转结果,那么一切都会很简单。
How a about this? 这是怎么回事? Manually plot each line in 3D stemming from the
x
axis: 手动绘制源自
x
轴的3D中的每条线:
x = 0:.01:2*pi*3;
z = sin(x);
y = -sin(x);
hold on
for n = 1:numel(x);
plot3([x(n) x(n)], [0 y(n)], [0 0], 'r');
plot3([x(n) x(n)], [0 0], [0 z(n)], 'b');
end
view(15,25)
As noted by @TheMinion, it's easier to use fill3
: 如@TheMinion所述,使用
fill3
更容易:
x = 0:.01:2*pi*3;
z = sin(x);
y = -sin(x);
fill3(x,y,zeros(size(x)),'r')
hold on
fill3(x,zeros(size(x)),z,'b')
view(15,25)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.