How to change number of tickmarks for dateaxis?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
MC3105
le 1 Déc 2014
Réponse apportée : Allan Kjærgaard Jensen
le 4 Jan 2016
Hey everyone,
I am trying to plot a time series that consists of 8760 data points with a value for each hour of the year. I want to show the values in the plot and display the months of the year on the x axis. I found the function dateaxis which seemed pretty easy, but matlab only displays four months of the year... I want all twelve...
Is there a way to tell dateaxis how many months to plot? If there is not, can you tell me a different way on how to plot my time series??
Thanks a lot!
0 commentaires
Réponse acceptée
Star Strider
le 1 Déc 2014
This works to plot months:
x = 0:8759;
y = sin(2*pi*x/(24*30.5)); % Something To Plot
xd = datenum([2014 01 01]) + x/24;
figure(1)
plot(xd, y)
set(gca, 'XTick', 0:11)
datetick('x', 'mmm')
axis tight
Your ‘xd’ and ‘y’ will be different but my set and datetick calls should work.
0 commentaires
Plus de réponses (1)
Allan Kjærgaard Jensen
le 4 Jan 2016
Try this one. It really works great and helped me with better plots.
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Performance dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!