Effacer les filtres
Effacer les filtres

Perspective problem in 3D plots with shared axes

4 vues (au cours des 30 derniers jours)
Mikel Quintana Uriarte
Mikel Quintana Uriarte le 20 Déc 2021
Commenté : DGM le 16 Fév 2024
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!!!

Réponses (1)

Pavan Sahith
Pavan Sahith le 16 Fév 2024
Modifié(e) : Pavan Sahith le 16 Fév 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);
% Original 3d plot
ax1 = nexttile;
%creating subplot for top view - X and Y axis
ax2 = nexttile;
view(ax2, [0 90]); % Set view for top view
%creating subplot for front view - X and Z axis
ax3 = nexttile;
view(ax3, [0 0]); % Set view for front view
This script will generate a figure with three subplots
  • the original 3D plot
  • Top view : which have the X-axis and Y-axis
  • Front View : which have the X-axis and Z-axis
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 commentaire
DGM le 16 Fév 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.

Connectez-vous pour commenter.


En savoir plus sur Colormaps dans Help Center et File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by