Datenum hour intervals within days to plot with imagesc (Matlab)

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 件のコメント

Cris LaPierre
Cris LaPierre 2023 年 5 月 23 日
Save your variables to a mat file and attach them to your post using the paperclip icon.
Pavel Inchin
Pavel Inchin 2023 年 5 月 23 日
I uploaded to my Dropbox (along with sript to plot it):
thanks in advance,
Walter Roberson
Walter Roberson 2023 年 5 月 23 日
Do you want 17:30-24:00 day 1, gap without data until 17:30 day 2? Or do you want 17:30-24:00 day 1, followed immediately by 17:30 day 2 without gap?
Note that when you pass XData and YData to imagesc() it only pays attention to the first and last entries in the array, so if you had [1 2 5 6 10 11] then it would linearly space 1 to 11.
Pavel Inchin
Pavel Inchin 2023 年 5 月 23 日
ok, I see.
yeah the idea is to plot "17:30-24:00 day 1, followed immediately by 17:30 day 2 without gap". I tried pcolor, but it creates that gap, which I want to avoid.
Cris LaPierre
Cris LaPierre 2023 年 5 月 23 日
Where are you seeing hour of day on your ticks? I only see month and day.
Pavel Inchin
Pavel Inchin 2023 年 5 月 23 日
yeah, here it doesn't show. but time ticks can be made presented (sorry I didn't add it to the script)

サインインしてコメントする。

回答 (1 件)

Walter Roberson
Walter Roberson 2023 年 5 月 23 日

0 投票

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 .

1 件のコメント

Pavel Inchin
Pavel Inchin 2023 年 5 月 23 日
got it thanks. will try to make these "fake" ticks

サインインしてコメントする。

カテゴリ

ヘルプ センター および File ExchangeDates and Time についてさらに検索

製品

質問済み:

2023 年 5 月 23 日

コメント済み:

2023 年 5 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by