import numpy as np
import matplotlib.pyplot as plt
import datetime
x = [datetime.datetime(2010, 12, 1, 0, 0), datetime.datetime(2011, 1, 1, 0,
    0), datetime.datetime(2011, 5, 1, 1, 0)]
y = [4, 9, 2]
ax = plt.subplot(111)
barWidth = 20
ax.bar(x, y, width=barWidth, align='center')
ax.xaxis_date()
plt.savefig('baralign.png')
plt.show()
matplotlib centered bar chart with dates