- the original 3D plot
- Top view : which have the X-axis and Y-axis
- Front View : which have the X-axis and Z-axis
Perspective problem in 3D plots with shared axes
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hi!
I want to create a figure with two subplots in the following manner:
I want a rotated view of the first subfigure such that the x-axis coincides with the second subfigure. My main problem is that, I cannot find suitable camera orientation, projection, view... etc that leave the x-axis fixed while the y-axis is rotated.
Thanks in advance!!!
0 Commenti
Risposte (1)
Pavan Sahith
il 16 Feb 2024
Modificato: Pavan Sahith
il 16 Feb 2024
Hello Mikel,
I assume that you're trying to find a method to manipulate the viewing angle of a 3D plot while maintaining the x-axis orientation.
MATLAB offers a straightforward solution for this with the 'view' function. It sets the azimuth and elevation angles of the camera's line of sight for the current axes.
For better understanding, I am attaching a sample MATLAB code, feel free to rearrange the tiled layout.
t = 0:pi/20:10*pi;
xt1 = sin(t);
yt1 = cos(t);
tiledlayout(1,3)
% Original 3d plot
ax1 = nexttile;
plot3(ax1,xt1,yt1,t)
xlabel('X')
ylabel('Y')
zlabel('Z')
%creating subplot for top view - X and Y axis
ax2 = nexttile;
plot3(ax2,xt1,yt1,t)
xlabel('X')
ylabel('Y')
zlabel('Z')
view(ax2, [0 90]); % Set view for top view
%creating subplot for front view - X and Z axis
ax3 = nexttile;
plot3(ax3,xt1,yt1,t)
xlabel('X')
ylabel('Y')
zlabel('Z')
view(ax3, [0 0]); % Set view for front view
This script will generate a figure with three subplots
To know more about the 'view' function , you can refer to the following MathWorks documentation.
You could also try exploring 'rotate' function - https://www.mathworks.com/help/matlab/ref/rotate.html
Hope this will help.
1 Commento
DGM
il 16 Feb 2024
This doesn't answer the question of how to create an oblique projection of two 2D axes aligned and oriented as shown. Axes objects only support orthographic and perspective projections, so trying to fake it by drawing things in planes in 3D isn't an option -- at least not by any simple means that I can think of off the top of my head. Creating a skewed 2D axes object also isn't an option.
Vedere anche
Categorie
Scopri di più su Subplots in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!