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

조회 수: 6 (최근 30일)
Stefan
Stefan 2025년 1월 30일
편집: Matt J 2025년 1월 31일
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일
편집: Matt J 2025년 1월 31일
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일
No, I don't think there is a way to lock it, unfortunately.
Matt J
Matt J 2025년 1월 31일
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 CenterFile Exchange에서 Plot Customization에 대해 자세히 알아보기

제품


릴리스

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by