Python matplotlib子图笨拙的日期时间xticks问题

Python matplotlib子图笨拙的日期时间xticks问题,python,datetime,matplotlib,subplot,colorbar,Python,Datetime,Matplotlib,Subplot,Colorbar,我有共享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.

我有共享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轴标签看起来笨拙,难以阅读


首先确保日期不是字符串。您可以按照上面的链接旋转文本。您也可以使用conciteFormatter@JodyKlymak Yes!我的日期确实是
dtype='datetime64[ns]'
格式,而不是字符串。此外,我还编辑了我的问题。现在,标签已旋转。我需要减少它们的频率。当你试图强制日期为XTICK时,你的绘图太小了。尝试将
figsize=(20,10)
传递到子批。您是对的。我玩了这个尺码。它解决了这个问题。谢谢