matplotlib bar chart with dates
All plot_date
does is plot the function and the call ax.xaxis_date()
.
All you should need to do is this:
import numpy as npimport matplotlib.pyplot as pltimport datetimex = [datetime.datetime(2010, 12, 1, 10, 0), datetime.datetime(2011, 1, 4, 9, 0), datetime.datetime(2011, 5, 5, 9, 0)]y = [4, 9, 2]ax = plt.subplot(111)ax.bar(x, y, width=10)ax.xaxis_date()plt.show()