Datenum hour intervals within days to plot with imagesc (Matlab)
2 views (last 30 days)
Show older comments
Good day,
I have an array UTTf in datenum format, which includes time markers for 10 days but only for [17:30-24] UTC.
I have the same size matrix cdgridN2f as time array and now I am trying to plot the data with imagesc.
imagesc(UTTf,lat,squeeze(cdgridN2f))
datetick
However, instead of having time intervals of [17:30-24] UTC for each day, imagesc shows timestamps starting from the beginning of the day for all days except the first one (see figure).
My question is to how properly plot time ticks so it shows the data merged from many days, but for only specific interval of hours within each day.
Thanks in advance,
6 Comments
Cris LaPierre
on 23 May 2023
Where are you seeing hour of day on your ticks? I only see month and day.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1391744/image.png)
Answers (1)
Walter Roberson
on 23 May 2023
What you will have to do is just use integer X coordinates, with the data in cdgridN2f having no gap (or perhaps a gap of 1), and use xticks() and xticklables() to set what shows up at what positions.
If you need data cursor to work to show you the date + time for each location instead of the relative offset, then you will need a custom callback function that fudges what to emit to the tooltip .
See Also
Categories
Find more on Dates and Time in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!