Graphical graph of dates and times

I have a list of objects datetime.datetime

that I want to represent in a scatterplot like this:


(source: stephenwolfram.com )

What should I do?

+3


source to share


2 answers


import pylab

# datetimes = [datetime(...), ...]

pylab.plot([dt.date() for dt in datetimes],
           [dt.hour + dt.minute/60. for dt in datetimes],
           ',')

      



+4


source


You shouldn't be using a graph, use plot_date instead of datetime arrays!



http://matplotlib.org/api/pyplot_api.html#matplotlib.pyplot.plot_date

0


source







All Articles