how to refrech XticksLabel when i zoom a graph in an app
15 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Steven Lord
2023-2-16
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.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!