how to refrech XticksLabel when i zoom a graph in an app
15 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
patrice boisset
am 16 Feb. 2023
Kommentiert: patrice boisset
am 17 Feb. 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 Kommentare
Akzeptierte Antwort
Steven Lord
am 16 Feb. 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.
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Data Exploration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!