Simple interactive plot with variable time axis

조회 수: 4 (최근 30일)
dormant
dormant 2022년 8월 7일
답변: Lei Hou 2022년 8월 31일
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
dormant 2022년 8월 8일
Thanks.
I'm just starting to get to grips with datetime, but slip back to datenum most of the time.
I'll add to this question when I have some working code.
dpb
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
Lei Hou 2022년 8월 31일
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

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

제품


릴리스

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by