How to view a 3D Figure from "below", e.g. z-axis facing downwards

10 views (last 30 days)
I'm looking for a possibility to view/rotate a North-East-Down Coordinate Frame in a 3D Figure.
By casually plotting a cartesian coordinate system z is facing upwards, and by rotating it with the hand tool, it is not possible to "flip" the figure so that z is facing down.
If you set the z-Axis to 'reverse' the right hand system becomes a left-hand system, thus this is not a solution.
figure
plot3(0,0,0)
line([0 0.1],[0 0],[0 0],'LineWidth',5,'DisplayName','X')
line([0 0],[0 0.1],[0 0],'LineWidth',5,'DisplayName','Y')
line([0 0],[0 0],[0 0.1],'LineWidth',5,'DisplayName','Z')
legend
Take the above picture, I would like a solution where the Z-Line is Facing downwards, without changing the coordinate-system

Accepted Answer

Matt J
Matt J on 30 Jan 2025
Edited: Matt J on 31 Jan 2025
Set the CameraUpVector axis property.
figure
plot3(0,0,0)
line([0 0.1],[0 0],[0 0],'LineWidth',5,'DisplayName','X')
line([0 0],[0 0.1],[0 0],'LineWidth',5,'DisplayName','Y')
line([0 0],[0 0],[0 0.1],'LineWidth',5,'DisplayName','Z')
set(gca, 'CameraUpvector',[0,0,-1])
legend
  3 Comments
Matt J
Matt J on 31 Jan 2025
No, I don't think there is a way to lock it, unfortunately.
Matt J
Matt J on 31 Jan 2025
After some tinkering, I seem to have managed to lock the orientation of the UpVector with the following. I don't know why they make it so hard...
plot3(0,0,0)
ax=gca;
hListener = addlistener(ax, 'View', 'PostSet',@forceDown);
line([0 0.1],[0 0],[0 0],'LineWidth',5,'DisplayName','X')
line([0 0],[0 0.1],[0 0],'LineWidth',5,'DisplayName','Y')
line([0 0],[0 0],[0 0.1],'LineWidth',5,'DisplayName','Z')
camup(ax, [0,0,-1])
function forceDown(~,evt)
ax=evt.AffectedObject;
camup(ax,[0,0,-1])
end

Sign in to comment.

More Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2024b

Community Treasure Hunt

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

Start Hunting!