I am a novice to Python/matplotlib so please bear with me! I have a list of epoch timestamps across several days and a boolean indicating whether an event occurred or not. I want to plot this using matplotlib with time on x-axis and Y-axis showing 1/0 and I see SO examples Plotting time in Python with Matplotlib for doing this.
However, I want to ignore the yr/month/date and plot only again time, i.e. 8 AM time on 1-Dec and 8 AM time on 2-Dec use the same X-axis coordinate.
Edit: Here is the current code:
import time
import datetime
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
event = [
(1384528771000000000, 1),
(1384550132000000000, 0),
(1384881104000000000, 0),
(1384962750000000000, 1),
(1384966615000000000, 1),
(1385049149000000000, 1),
(1385053051000000000, 0),
(1385053939000000000, 0),
(1385140573000000000, 1),
(1385393839000000000, 1),
(1385398965000000000, 0),
(1385410739000000000, 1),
(1385483309000000000, 1),
(1385587272000000000, 0),
(1385998456000000000, 1),
(1386084047000000000, 0),
(1386085865000000000, 1),
(1386259016000000000, 0),
(1386345606000000000, 0),
(1386602368000000000, 1)
]
for line in event:
timeStmp = datetime.datetime.strptime(time.ctime(line[0]/1000000000), "%a %b %d %H:%M:%S %Y")
print timeStmp, mdates.date2num(timeStmp)
plt.plot_date(mdates.date2num(timeStmp),line[1])
plt.show()