相关疑难解决方法(0)

日期时间 x 轴 matplotlib 标签导致不受控制的重叠

我正在尝试series'pandas.tseries.index.DatetimeIndex'. x 轴标签顽固地重叠,即使有几个建议的解决方案,我也无法使它们呈现出来。

我尝试了 建议使用的 stackoverflow 解决方案,autofmt_xdate但它没有帮助。

我也尝试了对 的建议plt.tight_layout(),但没有产生效果。

ax = test_df[(test_df.index.year ==2017) ]['error'].plot(kind="bar")
ax.figure.autofmt_xdate()
#plt.tight_layout()
print(type(test_df[(test_df.index.year ==2017) ]['error'].index))
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

更新:我使用条形图是一个问题。常规时间序列图显示管理良好的标签。

在此处输入图片说明

python matplotlib pandas

3
推荐指数
1
解决办法
6367
查看次数

标签 统计

matplotlib ×1

pandas ×1

python ×1