如何更改pandas.plot的x轴刻度频率
- 论坛
- 如何更改pandas.plot的x轴刻度频率
10 浏览
如何更改pandas.plot的x轴刻度频率
我正在使用pandas的.plot()函数绘制时间序列图,希望每个月都显示为一个x轴刻度。以下是数据集的结构:
以下是.plot()函数的结果:
我尝试使用其他帖子和matplotlib文档中的示例,做了如下尝试:
ax.xaxis.set_major_locator( dates.MonthLocator(revenue_pivot.index, bymonthday=1, interval=1))
但这样会移除所有刻度 🙁
我还尝试传递xticks = df.index
,但没有起到任何作用。
请问如何正确显示更多的x轴刻度?