指定两个日期之间的x间隔刻度

时间:2019-06-29 14:43:54

标签: python matplotlib

我有一个pandas.core.series.Series data,其索引从“ 2000-01-03”开始,到“ 2013-12-31”结束。以下是前15个数据点的示例

Date
2000-01-03    111.937502
2000-01-04    102.500003
2000-01-05    103.999997
2000-01-06     94.999998
2000-01-07     99.500001
2000-01-10     97.750001
2000-01-11     92.750000
2000-01-12     87.187503
2000-01-13     96.749998
2000-01-14    100.437499
2000-01-18    103.937499
2000-01-19    106.562499
2000-01-20    113.499994
2000-01-21    111.312501
2000-01-24    106.250002
Name: data, dtype: float64

当我在Jupyterlab中绘制数据时

plt.plot(data, color='blue')
plt.xticks(rotation=45)

由于重叠,刻度线及其标签仅以黑色粗块显示。如何将显示的刻度线之间的间隔指定为x天以防止重叠,以使X轴可读?谢谢!

0 个答案:

没有答案