3d plot with +Y up and +Z left
15 views (last 30 days)
Show older comments
William Rose
on 8 Apr 2025
Moved: Mathieu NOE
on 17 Nov 2025 at 9:02
When I plot a side view of a 3D object, with +Y axis up and +Z pointing left, the axis labels are in the wrong place or absent. See script and figure below. The script shows 2D views of a 3D object. The frontal and axial views, on the left side of the figure below, are fine. For the third view ("left lateral view"), I want +Y up and +Z pointing to the left (i.e. +X is into the screen). The code below plots the ellipsoid correctly, in the desired orientation, in the two plots on the right, but the axis labels are not OK. In th top right plot, the horizontal axis overlaps the title. In the bottom right plot, axis labels and ticks and tick labels are missing from both axes.
Example:
[X,Y,Z]=ellipsoid(0,0,0,3,9,1);
figure;
subplot(2,2,1); % this plot is OK
surf(X,Y,Z,'EdgeColor','none');
xlabel('X'); ylabel('Y'); zlabel('Z');
axis equal;
xlim([-10,10]); ylim([-10,10]); zlim([-10,10])
view(0,90); title('Frontal View');
subplot(2,2,3); % this plot is OK
surf(X,Y,Z,'EdgeColor','none');
xlabel('X'); ylabel('Y'); zlabel('Z');
axis equal;
xlim([-10,10]); ylim([-10,10]); zlim([-10,10])
view(0,0); title('Axial View')
subplot(2,2,2); % this plot is not OK
surf(X,Y,Z,'EdgeColor','none');
xlabel('X'); ylabel('Y'); zlabel('Z');
axis equal;
xlim([-10,10]); ylim([-10,10]); zlim([-10,10])
view([-1 0 0]); camup([0,1,0]);
title('Left Lateral View');
subplot(2,2,4); % this plot is not OK
surf(X,Y,Z,'EdgeColor','none');
xlabel('X'); ylabel('Y'); zlabel('Z');
axis equal;
xlim([-10,10]); ylim([-10,10]); zlim([-10,10])
campos([-1 0 0]); camup([0,1,0]);
title('Left Lateral View');
See here for a related discussion which does not answer my question. Thank you.
4 Comments
Accepted Answer
Mathieu NOE
on 8 Apr 2025
Moved: Mathieu NOE
on 17 Nov 2025 at 9:02
well if nothing works as expected I would probably end up doing a small function that plots my own referential as big X,Y,Z arrows in the main figure depending on which view options you have opted for
basta cosi
0 Comments
More Answers (0)
See Also
Categories
Find more on Vector Fields in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!