label is not at the center of axes

조회 수: 10 (최근 30일)
warnerchang
warnerchang 2022년 4월 12일
댓글: Star Strider 2022년 4월 12일
when I was plotting a 3D line, I tried to use xlabel/ylabel to make a axis label. However, I found these labels are not at the center of axes

채택된 답변

Star Strider
Star Strider 2022년 4월 12일
It is possible to force them to be exactly where you want them —
t = linspace(0, 5, 500);
x = cos(2*pi*t);
y = sin(2*pi*t);
figure
plot3(x, y, t)
xt = xticks;
yt = yticks;
text(median(xt),min(yt)-0.5, 0, sprintf('x'), 'Horiz','center', 'Vert','middle')
text(min(xt)-0.5,median(yt), 0, sprintf('y'), 'Horiz','center', 'Vert','middle')
grid on
% view(0,90) % Top-Down View (Optional)
They are in the centres of their respective axes here, although it is necessary to rotate the plot to see that, since the perspective distorts their positions.
.
  댓글 수: 2
warnerchang
warnerchang 2022년 4월 12일
Thank you so much!
Star Strider
Star Strider 2022년 4월 12일
My pleasure!
If my Answer helped you solve your problem, please Accept it!
.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Grid Lines, Tick Values, and Labels에 대해 자세히 알아보기

태그

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by