Is there any option like zline?

조회 수: 61 (최근 30일)
Nitin Phadkule
Nitin Phadkule 2021년 7월 23일
댓글: Chunru 2021년 8월 3일
I have drawn a 3D plot in app.UIAxes and added x and y axis by xline and y line, but not able to add zaxis line. why I am doing this because in 3D plots, axis is not located at origin. Is there any option like zline?

채택된 답변

Chunru
Chunru 2021년 7월 23일
If all you want is to plot x-y-z axis passing through origin, then you can do the following. (assuming that origin is somewhere inside the plot; otherwise set the xlim, ylim, zlim first).
x=(-2:.1:1);
y = (-1:.1:2);
z = peaks(x, y');
mesh(x,y,z);
hold on
xlabel('x'); ylabel('y'); zlabel('z');
h = gca;
plot3(h.XLim, [0 0], [0 0], 'r')
plot3([0, 0], h.YLim, [0 0], 'r');
plot3([0, 0], [0 0], h.ZLim, 'r');
view(60, 10)
  댓글 수: 3
Chunru
Chunru 2021년 8월 3일
Thanks for sharing.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Axis Labels에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by