I have this python code for displaying some numbers over time:
import matplotlib.pyplot as plt
import datetime
import numpy as np
x = np.array([datetime.datetime(2013, 9, i).strftime("%Y-%m-%d") for i in range(1,5)],
dtype='datetime64')
y = np.array([1,-1,7,-3])
plt.plot(x,y)
plt.axhline(linewidth=4, color='r')
plt.show()
The resulting graph has the numbers 0.0 to 3.0 on the x-axis:
What is the simplest way to display dates instead of these numbers? Preferably in the format %b %d.