Simple interactive plot with variable time axis
显示 更早的评论
I have a plot containing three subplots, all of which have date/time as the x axis.
Whats the easiest way of making this plot interactive, with only the following features:
- change the time axis for all three subplots together
- autoscale the y axes for the data visible in the plot.
It doesnt have to be a GUI. i'm happy to type xlim at the command prompt, as long as i can say things like 'now' and 'now minus 3 days'.
P.S. The data times are always in UTC, which is 4 hours ahead where i am. every single script i write has manual corrections to UTC. is it possible to get MATLAB to work in UTC by default?
4 个评论
dormant
2022-8-7
dpb
2022-8-7
linkaxes will handle the first bullet, plot will/does autoscale by default so not sure where this comes from (unless it's the fact you've not linked the axes and plotted different ranges on them)
As per usual, for more specific help/solutions/code that actually addresses a specific problem, providing a minimal working example including the data with which to run it would likely result in somebody picking up the challenge.
With only the above description, it's shooting at an unknown target...
The last should be taken care of if you use datetime -- I'm guessing you've been/are using the venerable datenum instead?
dormant
2022-8-8
dpb
2022-8-8
Particularly with plotting and if you're writing new code, DEFINITELY ditch datenum in favor of datetime and duration -- plot is now datetime aware and that lets you get rid of the very painful datetick entirely -- plus you can then set limits, ticks, etc., etc., directly in datetime values that don't have to go thru the number conversion to datenum so they're also legible as dates.
回答(1 个)
Lei Hou
2022-8-31
0 个投票
Hi Dormant,
The function "stackedplot" is designed to plot time series data corresponding to the same time. I guess that function is what you are looking for.
Thanks
Lei
类别
在 帮助中心 和 File Exchange 中查找有关 Dates and Time 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!