How can I keep the date visible at the bottom of the graph?

조회 수: 4 (최근 30일)
Needless Needless Also
Needless Needless Also 2018년 10월 26일
댓글: Needless Needless Also 2018년 10월 26일
So, I have been trying to figure out why the date at the bottom right of the graph keeps disappearing when I try to edit the X ticks and their labels. With the standard plot, the date is visible as shown:
But it disappears when I edit the ticks:
set(gca,'XTickLabel',xt) %xt is a cell array with the labels (empty cell for removing label)
set(gca,'XTick', xticks) %xticks is a double vector with the tick positions
It is really helpful to be kept there and I can't find out. Any ideas? Thanks

채택된 답변

jonas
jonas 2018년 10월 26일
편집: jonas 2018년 10월 26일
xticks should not be a double vector if you use datetime, it should be a datetime vector. I would expect anything else to return an error, but I could be wrong. Also, why are you changing the labels? Doing so will likely cause this behaviour. The date at the bottom right is a special datetime-type label. You can access it via
ax.XRuler.NodeChildren(1).String = 'test'
Messing with the labels might prompt the axis to remove that functionality.
Anyway, you need to show your script if you want a more precise answer.
  댓글 수: 3
jonas
jonas 2018년 10월 26일
편집: jonas 2018년 10월 26일
You dont have to change to ticklabels for that. Just change the xticks. The labels are changes automatically. Still the same problem? If so, can you provide your code and data?
Needless Needless Also
Needless Needless Also 2018년 10월 26일
You 're right. I just had to change the ticks and worked. Simple enough. Thanks again.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기

제품


릴리스

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by