Setting plot limits with dates, Part 2

28 ビュー (過去 30 日間)
alpedhuez
alpedhuez 2020 年 12 月 17 日
編集済み: Jakeb Chouinard 2020 年 12 月 17 日
I belive I have set the xlim to start from April 29. But the output plot starts from April 1. How can I really force the graph to start from April 1?

採用された回答

Jakeb Chouinard
Jakeb Chouinard 2020 年 12 月 17 日
編集済み: Jakeb Chouinard 2020 年 12 月 17 日
Once the figure is plotted, use xlim([x1,x2]) where x1 and x2 are in datetime form to force the graph's x-axis limits be x1 and x2.
See example below:
Where the minimum x-axis value is the thrid entry in the x datetime array and the maximum x-axis value is the last entry
For using datetick, try (if you want to keep the current tick locations):
datetick('x','mm/dd','keeplimits','keepticks')
If not, remove 'keepticks' and use:
set(gca,'XTicks',y) %where y is an array of values you want to use for your xticks in datetime form
xlim([x1,x2])
datetick('x','mm/dd','keeplimits')
  4 件のコメント
alpedhuez
alpedhuez 2020 年 12 月 17 日
whoa
Jakeb Chouinard
Jakeb Chouinard 2020 年 12 月 17 日
whoah indeed

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

その他の回答 (0 件)

カテゴリ

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by