필터 지우기
필터 지우기

How do I reset axis ticks to normal after I modify them?

조회 수: 25 (최근 30일)
Martijn Steenwijk
Martijn Steenwijk 2011년 5월 31일
Suppose I have turned on datetick for a specific axis. Is there a way to turn off / reset the axis ticks to normal mode with 'set' commands?

채택된 답변

Patrick Kalita
Patrick Kalita 2011년 5월 31일
You want to tell the axes to place the ticks wherever it thinks is best via the XTickMode property. You also want to tell the axes to decide automatically how to label those ticks using the XTickLabelMode property.
Here's the statement to do it:
set(gca, 'XTickMode', 'auto', 'XTickLabelMode', 'auto')
You can replace the call to gca with the axes handle if you have it. Of course you can set the YTickMode, ZTickMode, ect. properties if you applied datetick to the y- or z-axis.
  댓글 수: 1
Martijn Steenwijk
Martijn Steenwijk 2011년 5월 31일
This solves indeed the problem. Thanks for your reply!

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

추가 답변 (2개)

Ivan van der Kroon
Ivan van der Kroon 2011년 5월 31일
You can use
set(gca,'XTickLabel',xdate)
where xdate is your x-axis data. With datetick you're just changing the labels, but not the ticks themselves. Hope it helps!

Martijn Steenwijk
Martijn Steenwijk 2011년 5월 31일
Both solutions do not work. After XData first contained datenum output, I insert new data in the order of [0,100]. What I want is to show the related ticks, but currently none of the ticks is visible.
  댓글 수: 1
Oleg Komarov
Oleg Komarov 2011년 5월 31일
Solutions don't work says nothing about your problem (since both solutions do work if applied coherently) and it's not clear what's your problem.
To see what's the difference with your problem post the formatted code (editing your answer), otherwise no clue.

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

카테고리

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