python-matplotlib:figsize for subplot-在行之间添加空间
我使用以下代码进行绘图:python-matplotlib:figsize for subplot-在行之间添加空间,python,matplotlib,Python,Matplotlib,我使用以下代码进行绘图: fig, axes = plt.subplots(len(pairs), 3, figsize=(12, 324)) for i, pair in enumerate(pairs): d = pd.DataFrame(columns=[pairs[0], pairs[1]]) e = df_norm[list(pair)] ax0 = axes[i,0] ax1 = axes[i,1]
fig, axes = plt.subplots(len(pairs), 3, figsize=(12, 324))
for i, pair in enumerate(pairs):
d = pd.DataFrame(columns=[pairs[0], pairs[1]])
e = df_norm[list(pair)]
ax0 = axes[i,0]
ax1 = axes[i,1]
ax2 = axes[i,2]
d[pair[0]] = np.random.normal(e[pair[0]],0.02)
d[pair[1]] = np.random.normal(e[pair[1]],0.02)
d.plot.scatter(*pair, ax=ax0, c=col0, linewidths=0, s=2, alpha = 0.7)
d.plot.scatter(*pair, ax=ax1, c=col1, linewidths=0, s=2, alpha = 0.7)
d.plot.scatter(*pair, ax=ax2, c=col2, linewidths=0, s=2, alpha = 0.7)
fig.tight_layout()
然而,我的输出图都搞砸了,比如:
我试图通过使324变大或变小来改变
figsize=(12324)
,但两者都没有帮助。有没有办法在每一行之间留出一些空间,这样数字就不会乱了。谢谢 您需要使用ommit图紧密的布局()
,而不是使用
有一些非常极端的值hspace
是子地块之间的垂直间隙(很可能以子地块高度为单位)
Figure
具有相同的子地块调整方法,因此您可以决定选择哪个。在我看来,最简单的方法是坚持使用h\u pad
(高度)和w\u pad
(宽度)。例如:
图紧密布局(h\U垫=5,w\U垫=5)
请提供。
plt.subplots_adjust(top = 0.99, bottom=0.01, hspace=1.5, wspace=0.4)