필터 지우기
필터 지우기

How can I keep the yaxis label inside rather than outside

조회 수: 4 (최근 30일)
CODER
CODER 2022년 10월 17일
답변: Davide Masiello 2022년 10월 17일
How can I keep the yaxis label inside rather than outside

답변 (2개)

Davide Masiello
Davide Masiello 2022년 10월 17일
편집: Davide Masiello 2022년 10월 17일
You could play around with the "Position" field of the text structure of the label.
See below
plot(1:10,1:10)
xlabel('xlabel')
yl = ylabel('ylabel');
yl.Position
ans = 1×3
-0.6180 5.5000 -1.0000
plot(1:10,1:10)
xlabel('xlabel')
yl = ylabel('ylabel');
a = gca;
a.YRuler.TickLabelGapOffset = -15;
Warning: Error updating Axes.

Update failed for unknown reason.
% yl.Position = [1 5.5000 -1];
  댓글 수: 2
CODER
CODER 2022년 10월 17일
How can you put the tick level (1 2 3 4 5 6 7 8 9 10) inside in yaxis with the ticks rather than outside?
Davide Masiello
Davide Masiello 2022년 10월 17일
Changed the answer, that's the only way I know of.

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


Davide Masiello
Davide Masiello 2022년 10월 17일
Other possibility, a bit cumbersome I'd say
plot(1:10,1:10)
xlabel('xlabel')
ylabel('ylabel')
a = gca;
a.YTickLabels = {''};
a.YLabel.String = {''};
axis([0 11 0 11])
t1 = text(0.025*diff(a.XLim)*ones(10,1),(1:10)',num2cell(1:10));
t2 = text(0.075*diff(a.XLim),5.5,'Ylabel');
t2.Rotation = 90;
t2.HorizontalAlignment = 'center';

카테고리

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