简体   繁体   English

如何在Matlab中将2d图形置于3d图形的前面?

[英]How to bring the 2d graph in front of the 3d graph in matlab?

The 2d graph should be visible when view from 0,90 but when I get the result most of the line does not visible. 从0.90开始查看时,二维图应该可见,但是当我得到结果时,大部分直线都不可见。

x=(0:0.5:2);
y=(0:0.5:2);

x=linspace(0,2);
y=linspace(0,2);
[X,Y]=meshgrid(x,y);
fx=sin(3*(X.^2+Y.^2)).*exp(-0.5*(X.^2+Y.^2));
h1=mesh(x,y,fx);
mxf=max(max(fx));
mif=min(min(fx));
axis([0,2,0,2,mif,mxf]);
surf(x,y,fx)
hold all;
fz= sin (x) .* exp (-x/2);
view(0,90);
plot(x,fz,'r-');

You could use plot3 to place the line above the surface: 您可以使用plot3将线放置在表面上方:

fz      = sin (x) .* exp (-x/2);
fxAbove = fz*0 + 1.05*max(fx(:));
plot3(x , fz , fxAbove ,'r-');
hold all;
surf(x,y,fx)
view(0,90);

I reorganized the plotting order since the surface coloring gets messed up on my system (not sure why). 我重新组织了绘图顺序,因为系统上的表面颜色混乱了(不确定原因)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM