xAxis of plot starts when no data is available

1 次查看(过去 30 天)
I want to plot price data with the corresponding date on the x axis.
figure(1);
Datum = table2array(Dates(p_date_c:p_date_c+z,1));
plot(Datum, pricedata)
xlabel('Time')
ylabel('Total Return')
The "Datum" is in datetime format and ranges from 31-Dec-2019 to 31-Dec-2020, and so do the pricedata! pricedata and Datum has the same length. But why does the plot starts in Oct-2019, and not Dec-2019?
Thanks in advance

采纳的回答

Walter Roberson
Walter Roberson 2021-1-22
MATLAB is trying for "nice" tick marks. With the datetime values you are giving it, everything except December 31 2019 fits in nicely to create ticks by quarters. Going back to Oct 2019 is extending back one further quarter in order to accomodate the December 31 2019 entry.

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by