首页 > 解决方案 > Python matplotlib subplot 笨拙的日期时间 xticks 问题

问题描述

我有共享 x,y 轴的子图。x 轴是日期时间戳。一切看起来都很好。问题是 x 轴看起来很笨拙。

我的代码:

fig, ax = plt.subplots(nrows=rows, ncols=cols,sharey=True,sharex=True)
fig.subplots_adjust(hspace=0.025, wspace=0.05)
for i in range(rows):
    for j in range(cols):
        #### plot data goes here. 
        ax[i,j].autofmt_xdate()
        ax[i,j].xaxis.set_tick_params(rotation = 30)
fig.subplots_adjust(right=0.95)
plt.show()

当前输出:x 轴标签看起来很笨拙,难以阅读。

在此处输入图像描述

标签: pythondatetimematplotlibsubplotcolorbar

解决方案


推荐阅读