3d plot with +Y up and +Z left

조회 수: 14 (최근 30일)
William Rose
William Rose 2025년 4월 8일
이동: Mathieu NOE 2025년 11월 17일 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
William Rose
William Rose 2025년 11월 15일 1:53
@Mathieu NOE, if you change you comment to an answer, I would like to accept it.
Mathieu NOE
Mathieu NOE 2025년 11월 17일 9:01
that's very kind - will do
have a nice day

댓글을 달려면 로그인하십시오.

채택된 답변

Mathieu NOE
Mathieu NOE 2025년 4월 8일
이동: Mathieu NOE 2025년 11월 17일 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개)

카테고리

Help CenterFile Exchange에서 Vector Fields에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by