Plot a tilted looking polygon

2 次查看(过去 30 天)
KRUNAL
KRUNAL 2014-10-22
回答: Ced 2014-10-22
I have the following data that creates 3-d plot
x_min = 200; x_max = 500;
rand_x = x_min + (x_max - x_min )*rand(60,1);
y_min = -500; y_max = 950;
rand_y = y_min + (y_max - y_min )*rand(60,1);
z_min = -50; z_max = 50;
rand_z = (z_max - z_min )*rand(60,1);
plot3(rand_x,rand_y,rand_z,'x')
When I rotate it to look from the 2-d view it looks something like this :
What I want is, using the data(min n max of each axis can be changed) and using the same view i.e 2-d view of 3-d data, I want this to look a little tilted. Can anyone tell me how it can be done?

回答(1 个)

Ced
Ced 2014-10-22
Hi
You could simply multiply your points with a rotation matrix, e.g.
phi = pi/6;
R = [ cos(phi) sin(phi) 0 ; -sin(phi) cos(phi) 0 ; 0 0 1 ]; % R' turns in other direction
rand_new = R*[ rand_x' ; rand_y'; rand_z' ];
and plot them again. This changes the points (but makes the view look tilted as requested). Alternatively, if you only want to change the viewing angle, but keep the points at the same coordinates, you may need to play around with "view".

类别

Help CenterFile Exchange 中查找有关 Bar Plots 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by