Setting plot XAxis limits using a segment of time in the data
7 ビュー (過去 30 日間)
古いコメントを表示
Apologies if this sounds very elementary but I am plotting a line plot where the x axis is time. My variable (dtg) is in datetime format but goes for 3 consecutive days. I would like to plot only the range 10 Apr 2017 16:00:00 to 10 Apr 2017 18:20:00. All my other axis properties are fine, but xlim keeps giving me a error saying that Apr is not defined. I am using R2016b
ax=gca; ax.xlim([10 Apr 2017 16:00:00,10 Apr 2017 18:20:00]);
Thanks
0 件のコメント
回答 (1 件)
Jan
2017 年 5 月 11 日
t1 = datenum('10 Apr 2017 16:00:00');
t2 = datenum('10 Apr 2017 18:20:00');
ax.xlim([t1, t2]);
Does this work? If not, read the doc datenum to adjust the time format.
参考
カテゴリ
Help Center および File Exchange で Annotations についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!