how to refrech XticksLabel when i zoom a graph in an app
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
patrice boisset
le 16 Fév 2023
Commenté : patrice boisset
le 17 Fév 2023
Good morning
I'm using datestr for printing time on th xlabel axis but if i zoom all the label became wrong.
I've got the write command to refresh the X labels but I think there is a mean to create a callback when the zoom is activated.
I'm in a app designed figure but if it's possible in classicle figure i'm intersted to.
regards
0 commentaires
Réponse acceptée
Steven Lord
le 16 Fév 2023
Rather than calling datestr or datetick I recommend plotting using a datetime array as your X data.
v = 0:10;
y = v.^2;
tenDays = datetime('today') + days(v)
plot(tenDays, y)
As you zoom in on the axes MATLAB will automatically update the tick labels. If you want to customize the format used to display the datetime data you can use the xtickformat function to do so.
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Data Exploration 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!

