How to split x-axis (6 years of timeseries) with datetick into monthly intervals?

4 views (last 30 days)
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
grid on
NumTicks = 72;
L = get(gca,'XLim');
datetick('x','mmm yyyy', 'keepticks')
set(gca,'XMinorTick','on') %,'YMinorTick','on')
rotateticklabel(gca, 90);

Answers (0)


Find more on View and Analyze Simulation Results 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!