フィルターのクリア

How to set start date in line plot?

1 回表示 (過去 30 日間)
peterhack
peterhack 2016 年 11 月 12 日
コメント済み: dpb 2016 年 11 月 13 日
Hi,
I was wondering how to set the start date of the plot to be march for example.
t = datetime(2013,01,01):calmonths(1):datetime(2013,12,31);
[y,m,d] = ymd(t);
x = month(t,'shortname');
h = datetime(x,'Format','MMM');
z = rand(1,12);
plot(t,z,'DatetimeTickFormat','MMM')
Thanks!

採用された回答

dpb
dpb 2016 年 11 月 12 日
xl=xlim; % retrieve current limits
xlim([datetime(2013,03,01) xl(2)]) % set beginning x-limit to 3/1/2013, keep end as is
Salt to suit...
  2 件のコメント
peterhack
peterhack 2016 年 11 月 12 日
Any way to get rid of the single 2013 in the plot?
dpb
dpb 2016 年 11 月 13 日
???? No idea what you mean?

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDates and Time についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by