필터 지우기
필터 지우기

about axis ticks: how to set 10 ticks with 5 labels?

조회 수: 2 (최근 30일)
Yuji Zhang
Yuji Zhang 2013년 11월 23일
댓글: Yuji Zhang 2013년 11월 23일
Hi everyone,
I want the axis to have ticks at 1:1:10, and tick labels only at 2:2:10
Anybody know how to do this? I tried
x=1:10;
y = x;
plot(x, y)
ylim([0 10])
set(gca,'YTick', 1:1:10, 'YTickLabel', 2:2:10 );
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 2 2])
print(gcf,'-dtiffn','-r600', 'test.tiff');
The result is something that doesn't make sense. See attachment please.

채택된 답변

Azzi Abdelmalek
Azzi Abdelmalek 2013년 11월 23일
편집: Azzi Abdelmalek 2013년 11월 23일
x=1:10;
y = x;
plot(x, y)
ylim([0 10])
set(gca,'YTick', 1:1:10, 'YTickLabel', {'' '2' '' '4' '' '6' '' '8' '' '10'} );

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