active date axis in plot: zoom in from year to hour
2 views (last 30 days)
Show older comments
Dear Matlab Community,
I have a time series plot includes data from Sept to May. I want to see the hourly plot when I zoom in but guess I am missing a point.
I have tried to use dynamicDateTicks as:
Option 1:
dynamicDateTicks([],[],'yy/mm/dd hh/mm/ss')
Option 2:
dynamicDateTicks()
and other variations as mm/dd, yy/mm/dd but nothing is changed.
Do you have any suggestion for dynamic plots?
Thank you in advance!
Best,
Ezgi Asirok
3 Comments
dpb
on 24 Jun 2022
Edited: dpb
on 24 Jun 2022
..."tried to use uppercase in date and time ..."
Could be interpreted a couple of ways -- but if used all uppercase, that's not right, either. The date portion is lower case, the time portion upper. The case difference is how it knows the difference between months and minutes, both of which use some number of the letter 'm' -- mixing cases for one in the location for the other is a problem. I've not checked just how good the error diagnostics are and don't recall datetick behavior well enough to know whether it would provide error/warning messages or just quietly give unexpected results -- or whether the wrapper code may have stuff inside try...catch constructs and hide errors that aren't handled.
That is quite old code; not terribly surprising it may not work with newer releases...would take a lot of digging to uncover where things may have gone south and with datetime there's really no reason to invest time into it -- datenum had its day in the sun, but has been eclipsed in current MATLAB implementations by the new datetime and duration classes -- and since TMW will not be updating plotting routines in particular to use a datenum with automated axes recognition, there really isn't reason to use them in new code.
There's a convenience with datenum for some purposes, granted, in that they can hold a time portion independent of a date that a datetime can't (one must use duration for that, instead).
Answers (0)
See Also
Categories
Find more on Time Series Objects in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!