首页 > 解决方案 > 为什么我的 matplotlib 子图水平距离不会变小?wspace 无功能

问题描述

我似乎无法缩小两列之间的距离,而 subplots.adjust 函数似乎不允许它变小。我已经使用 hspace 和 wspace 命令来尝试强制它,但是它似乎不起作用。我有

fig, axs = plt.subplots(4, 2, dpi=300)
fontprops = fm.FontProperties(size=6,weight='bold')

for i in range((4)):
    for j in range(2):
        axs[i][j].set_yticks([])
        axs[i][j].set_xticks([])


axs[0,0].imshow(ITO10_Dimer1SI_Linear_Norm,cmap=ice_map1)
axs[0,0].text(38,4,'565 meV', color='w',fontsize=6,fontweight='bold')
axs[1,0].imshow(ITO10_Dimer1SI_Parallel_Norm,cmap=ice_map1)
axs[1,0].text(38,4,'785 meV', color='w',fontsize=6,fontweight='bold')
axs[2,0].imshow(ITO10_Dimer1SI_aParallel_Norm,cmap=ice_map1)
axs[2,0].text(38,4,'910 meV', color='w',fontsize=6,fontweight='bold')
axs[3,0].imshow(ITO10_Dimer1SI_aLinear_Norm,cmap=ice_map1)
axs[3,0].text(38,4,'970 meV', color='w',fontsize=6,fontweight='bold')

axs[0,1].imshow(BondIP_Norm,cmap='hot') 
axs[1,1].imshow(ParaIP_Norm,cmap='hot')
axs[2,1].imshow(ParaOP_Norm,cmap='hot') 
axs[3,1].imshow(BondOP_Norm,cmap='hot')

plt.subplots_adjust(hspace=0.05,wspace=0.5)
plt.show()

输出

标签: pythonmatplotlibplotsubplotimshow

解决方案


推荐阅读