active date axis in plot: zoom in from year to hour

조회 수: 2 (최근 30일)
Cakil
Cakil 2022년 6월 23일
편집: dpb 2022년 6월 24일
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
Cakil
Cakil 2022년 6월 24일
Thank you for your detailed comment, using datetime instead of datenum is solved my problem.
Just for information: I also tried to use uppercase in date and time but it did not work in neither dynamicDateTicks nor the datetick.
dpb
dpb 2022년 6월 24일
편집: dpb 2022년 6월 24일
..."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).

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Time Series Objects에 대해 자세히 알아보기

태그

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by