Dates beside the axis when plotting datetime

조회 수: 1 (최근 30일)
Hiroyuki Kubota
Hiroyuki Kubota 2020년 9월 22일
편집: Adam Danz 2023년 10월 18일
I'm trying to plot changes on a specific date of a long intraday data, and want to show (1) only the time and erase the date which appears beside the axis, or (2) change the language of the date beside the axis.
  댓글 수: 1
Walter Roberson
Walter Roberson 2020년 9월 22일
There is a private property named ScaleFormat_I that is under the XAxis property of the axes.
Unfortunately, it does not appear to be possible to set the property, and the details of constructing datetime rulers is hidden inside a .p file toolbox/matlab/graphics/axis/+matlab/+graphics/+axis/+decorator/DatetimeRuler.p

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

채택된 답변

Abby Skofield
Abby Skofield 2023년 9월 20일
편집: Adam Danz 2023년 10월 18일
Starting in R2023b, you can use the new family of secondary label functions (e.g. xsecondarylabel) to toggle the visiblity of the secondary label off.
t = datetime('September 1, 2023'):days(1):(datetime('now')+days(90));
y = cumsum(randn(size(t)));
plot(t,y)
title('Fall 2023')
xsecondarylabel('Visible','off')
You can also use the new functions to add custom secondary labels.
ysecondarylabel('USD, millions')
For more info and demos on secondary labels, see the Graphics and App Building blog article below.

추가 답변 (1개)

Seth Furman
Seth Furman 2020년 10월 21일
1) The date information can be hidden by setting the TickLabelsMode to 'manual' on the DatetimeRuler.
ax = gca;
ax.XAxis.TickLabelsMode = 'manual';
2) The default input locale for datetimes can be changed in the Preferences dialog box (i.e. Preferences > Command Window > Datetime format > Locale).

카테고리

Help CenterFile Exchange에서 Dates and Time에 대해 자세히 알아보기

태그

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by