Histogram2 with datetime variables

I'm trying to graph some data in a 2d histogram I need this data to be versus time in half hour increments. I have my initial time data in decimal day units, and have converted it to datetime and seconds from epoch using posixtime. My problem is I want the Xtick labels to be in a datetime format like hh:mm, but histogram2 doesn't work with datetime variables, so I can't use that. And anytime I graph with the seconds I find it impossible to convert the tick labels to a readable datetime format. How would I do this?
I'm going over two days (134.0 - 135.99) with bins every half hour. If you need any more information pleas elet me know, I'm trying to do this today. Below is some of my time data:
Decimal Days:
134.001667000000
134.004444000000
134.007222000000
134.010000000000
134.012778000000
134.015556000000
134.018333000000
134.146111000000
134.148889000000
134.151667000000
134.154444000000
134.157222000000
134.160000000000
134.162778000000
134.165556000000
134.168333000000
134.171111000000
134.173889000000
134.176667000000
134.179444000000
134.182222000000
134.185000000000

3 Kommentare

dpb
dpb am 25 Jun. 2020
" datetime format like hh:mm"
From when? What do you want 134.001667 days to be? A duration in hh:mm?
Cordelia David
Cordelia David am 25 Jun. 2020
The date of 134 decimal days is May 15th, 2014. I want to graph my data against the array of time I have, whether that's datetime, seconds, duration or whatever. The main thing is that the x tick labels are in a time format so the graph is readable.
dpb
dpb am 25 Jun. 2020
Bearbeitet: dpb am 25 Jun. 2020
See doc Examples for datetick -- they show a bar3 example -- I think you can do same thing with histogram if use the deprecated datenum
Does seem worthy enhancement request for all the bar and histogram routines -- dunno why they've been left out.
There is a problem that datetick doesn't know about durations so can't label with hours > 0-23--the only way around that I can see would be to create a second time axes from same position as the histogram2 and put the annotations on it.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Discrete Data Plots finden Sie in Hilfe-Center und File Exchange

Produkte

Version

R2020a

Gefragt:

am 25 Jun. 2020

Bearbeitet:

dpb
am 25 Jun. 2020

Community Treasure Hunt

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

Start Hunting!

Translated by