Although this is an old question, I would like to point out again a more detailed answer.
In principle, matplotlib can work independently with datetime.datetime objects. You can simply connect them as data. To correct your formation, use:
xfmt = matplotlib.dates.DateFormatter('%H:%M:%S:%f') ax.xaxis.set_major_formatter(xfmt) ax.plot(datetimes, data)
Adjust the format to suit your needs. A description of the directive directives can be found in the PythonLibrary in section 8.1.7.
Sasha source share