필터 지우기
필터 지우기

How to make axis line invisible but keep xlabel and ylabel?

조회 수: 32 (최근 30일)
Mr M.
Mr M. 2018년 7월 23일
댓글: Adam Danz 2021년 4월 19일
I tried axis off, or set(gca,'xcolor','w'), but the problem is I want to keep the xlabel, morover white color is not good for me, because I am using imagesc and white ticks are visible on the colored figure.

채택된 답변

jonas
jonas 2018년 7월 23일
편집: jonas 2018년 7월 23일
h=get(gca);
set(h,'xcolor','none')
h.XAxis.Label.Color=[0 0 0];
h.XAxis.Label.Visible='on';
  댓글 수: 6
Walter Roberson
Walter Roberson 2021년 3월 12일
imagesc(rand(32,40))
xlabel('x')
ylabel('y')
zlabel('z')
h = gca; %fixed relative to jonas's suggestion
set(h,'xcolor','none')
h.XAxis.Label.Color=[0 0 0]; h.XAxis.Label.Visible='on';
The y label ticks are visible; the x label ticks are not; the x label itself is visible.
However, I have not tried this in R2019b.
Adam Danz
Adam Danz 2021년 4월 19일
Another approach:
ax.XRuler.Axle.Visible = 'off'; % ax is axis handle
ax.YRuler.Axle.Visible = 'off';
Credit: Yair's UndocumentedMatlab

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

추가 답변 (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