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

36 ビュー (過去 30 日間)
Stefan
Stefan 2025 年 1 月 30 日 13:33
編集済み: Matt J 2025 年 1 月 31 日 19:36
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

採用された回答

Matt J
Matt J 2025 年 1 月 30 日 14:50
編集済み: Matt J 2025 年 1 月 31 日 19:36
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 件のコメント
Matt J
Matt J 2025 年 1 月 31 日 13:25
No, I don't think there is a way to lock it, unfortunately.
Matt J
Matt J 2025 年 1 月 31 日 19:33
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

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangePlot Customization についてさらに検索

製品


リリース

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by