Here is my code:
import datetime as dt
import matplotlib.pyplot as plt
import matplotlib.dates as mdates
dates = ['2014-12-15','2015-11-07','2016-01-10']
x = [dt.datetime.strptime(d,'%Y-%m-%d').date() for d in dates]
plt.gca().xaxis.set_major_formatter(mdates.DateFormatter('%m/%d/%Y'))
plt.gca().xaxis.set_major_locator(mdates.DayLocator())
plt.stackplot(x,[1,2,3],[7,8,3])
plt.gcf().autofmt_xdate()
plt.show()
It produces the following plot:
How do I fix it to have only 3 dates? I followed the following example: SO example