One - One Code All

Blog Content

matplotlib X轴日期倾斜位置调整(双Y轴)

Python   2020-03-07 16:03:18

如果使用了to_datetime方法设置labels日期会自动倾斜。

双Y轴时,xtick设置rotation是不起作用的。

需要使用autofmt_xdate方法。


例子:

fig X轴坐标为正且居中。

fig.autofmt_xdate(rotation=0,ha='center')



上一篇:matplotlib绘图横坐标或纵坐标文本显示不全
下一篇:开发者国内镜像汇总

The minute you think of giving up, think of the reason why you held on so long.