Changing x-axis scale for hours
Afficher commentaires plus anciens
Hello I have hourly data from 1 week (168 hours) I would like to have the x-axis scale to be 1...24 1...24 etc instead of 1....168
How could this be achieved?
Thanks in advance!
Réponses (1)
For that to work, you would need to convert your x data to a datetime array, where there is a date associated with each time. Then you could have the axis display the hours. Maybe something like this?
x = 1:5:40;
y = rand(size(x));
startDate = datetime(2020,02,01,0,0,0)
x = startDate + hours(x)
plot(x,y)
xtickformat('HH');
Catégories
En savoir plus sur MATLAB dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
