My data records the time whereby workers finished their daily task. The list has 100,000 entries. The time are within the range of 15:00:00 to 19:00:00
I have difficult plotting the data as histogram due to the x-axis are in different format.(My histogram will have missing space from 61 to 99 minutes)
Data=['16:24:00',
'17:48:00',
'16:10:00',
'16:46:00',
'17:13:00',
'15:31:00',
'16:23:00',
'16:53:00',
'16:28:00',
'16:33:00',
'17:38:00',
'17:08:00',
'16:29:00',
'16:25:00',
'16:17:00',
'17:38:00',
'16:29:00',
...]
I have tried using matplotlib.dates to format the axis but encounter ValueError: ordinal must be >= 1
Attempt 1
fig, ax = plt.subplots(1,1)
ax.hist(Data ,bins=50)
ax.xaxis.set_major_locator(mdates.DayLocator())
ax.xaxis.set_major_formatter(mdates.DateFormatter('%H:%M:%S'))
ax.xaxis.set_minor_locator(mdates.MinuteLocator())
plt.show()
Attempt 2
fig, ax = plt.subplots(1,1)
locator = mdates.AutoDateLocator()
ax.hist(Data ,bins=50)
ax.xaxis.set_major_locator(locator)
ax.xaxis.set_major_formatter(mdates.AutoDateFormatter(locator))
ax.xaxis.set_minor_locator(mdates.MinuteLocator())
plt.show()
I hope to get something like this but with x-axis printed and y-axis represents occurrences