How to move a (x,y) line plot to the z axis?
2 次查看(过去 30 天)
显示 更早的评论
Hi everyone
I have recently got matlab and have been trying to use it to plot some functions. So far, i have been using plot(x,[y0,y1,y2....]) to plot several functions in one 2D plot, how can i move the y lines along the z axis to give a 3d view instead of them overlapping, with spacing long z, (0:7.5:60). So y0 would be at z=0, y1 at z=7.5, y2 at z=15. If the spacing can be filled in aswell to look like a smooth plain. If that makes any sense any help would be welcome. Thank you.
1 个评论
José-Luis
2014-10-22
I don't get it. Can't you just stack your lines in a 2D plot (add an offset to the y values)?
回答(1 个)
Matt Tearle
2014-10-22
编辑:Matt Tearle
2014-10-22
Something like this, perhaps?
x = linspace(0,1)';
y1 = cos(2*pi*x);
y2 = x.^2;
y3 = y1.*y2;
ribbon(x,[y1,y2,y3],1)
The "z" values (actually x in MATLAB's world!) are 1, 2, 3,... instead of 0, 7.5, 15,... but that can be faked, if you really need:
ax = gca;
n = (1:3)'; % change the 3 to however many y variables there are
ax.XTick = n;
ax.XTickLabel = num2str(7.5*(n-1));
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!