0
這裏日期是我的代碼:堆積面積圖和在matplotlib
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()
它產生以下情節:
如何解決它只有3個日期?我跟着下面的例子:SO example