Display dates on x axis

7 ビュー (過去 30 日間)
CARLOTTA DENTICO
CARLOTTA DENTICO 2021 年 7 月 12 日
コメント済み: Cris LaPierre 2021 年 7 月 12 日
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 日
Use the xticks function to set your x-tick locations.
  2 件のコメント
CARLOTTA DENTICO
CARLOTTA DENTICO 2021 年 7 月 12 日
I tried but it seems not working..
plot(TT, mtx1000pt, 'b');
xticks(1:2:348);
grid on
datetick('x', 'yyyy-mm')
Cris LaPierre
Cris LaPierre 2021 年 7 月 12 日
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 件)

カテゴリ

Help Center および File ExchangeAnnotations についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by