简体   繁体   中英

plot 2D intensity figure in 3D coordinate system

I have a 2D intensity plot, as in this example:

[xx yy] = meshgrid(0:0.1:1, 0:0.1:1);

figure(1)
imagesc(sin(xx)) %(x,y)-plot at z=0

Now, as I have noted in the comment, this plot is in the xy -plane and I have taken z=0 . I'd like to plot this in a 3D coordinate system as a function of x and y , but taking z=0 . I tried with plot3 in this way, plot3(xx,yy,cos(yy)) , but that only plots lines and gives them a curvature which I am not interested in. I'd like only a plane at z=0 .

You can use surf to accomplish this. We use the xx and yy meshgrid outputs as the x and y positisions, a matrix of zeros as the z value and sin(xx) as the color. We also remove the edges by setting the EdgeColor to none .

surf(xx, yy, zeros(size(xx)), sin(xx), 'EdgeColor', 'none')

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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