Hello everybody,
I wuold like to change time interval in the x axis every two years instead of every five years.
Thank you very muchbin advance

 채택된 답변

Cris LaPierre
Cris LaPierre 2021년 7월 12일

0 개 추천

Use the xticks function to set your x-tick locations.

댓글 수: 2

I tried but it seems not working..
plot(TT, mtx1000pt, 'b');
xticks(1:2:348);
grid on
datetick('x', 'yyyy-mm')
We need to know what your x data looks like to give a solution specific to you. Is your x data already a datetime?
% spaced every 5 years
x = datetime(1990,1,1):years(1):datetime(2021,1,1);
y = rand(1,length(x));
plot(x,y)
% Use xticks to space every 2 years
figure
plot(x,y)
xticks(x(1):years(2):x(end))
xtickformat('yyyy')

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Annotations에 대해 자세히 알아보기

태그

질문:

2021년 7월 12일

댓글:

2021년 7월 12일

Community Treasure Hunt

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

Start Hunting!

Translated by