Python matplotlib时间序列图 - 在x轴上显示年份

时间:2016-11-13 19:05:54

标签: python matplotlib

Python代码

import matplotlib.pyplot as plt
...
xx["SPY"].plot()
plt.show()

其中xx是具有日期索引的数据框,生成时间序列图,其中日期11/30 / 2010,9 / 15 / 2011,7 / 2/120等在x轴上显示为标签。我想对应于年份的标签,因此在x轴上仅显示“2010”,“2011”,“2012”等。怎么办呢?

0 个答案:

没有答案