Plot a tilted looking polygon
1 回表示 (過去 30 日間)
古いコメントを表示
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 :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/145830/image.png)
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?
0 件のコメント
回答 (1 件)
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".
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Bar Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!