How to split x-axis (6 years of timeseries) with datetick into monthly intervals?
1 view (last 30 days)
Show older comments
Hello,
I've got my time series data of 6 years plus and I would like to plot them in that way so that in the x-axis I would have the year and the month.
I tried the code below, but it gives me strange result, for example some months are skipped, the spacing does not seem to be equal sized.
What do you think I could do?
Thanks a lot!
%%
startdate = datenum('20-Oct-2002 15:00:00');
enddate = datenum('28-Dec-2008 11:00:00');
t = linspace (startdate,enddate,54261); %54261 is the length of my dataset
figure
plot(t,Rain)
grid on
NumTicks = 72;
L = get(gca,'XLim');
set(gca,'XTick',linspace(L(1),L(2),NumTicks))
datetick('x','mmm yyyy', 'keepticks')
set(gca,'XMinorTick','on') %,'YMinorTick','on')
rotateticklabel(gca, 90);
0 Comments
Answers (0)
See Also
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!