我使用以下代码制作图:
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()
Run Code Online (Sandbox Code Playgroud)
但是,我的输出图都搞砸了:
我尝试figsize=(12, 324)通过使324更大或更小来改变,但都没有帮助.有没有办法我可以在每一行之间放置一些空格,这样数字就不会搞砸了.谢谢!
Imp*_*est 11
你需要省略fig.tight_layout()而是使用subplots_adjust.
plt.subplots_adjust(top = 0.99, bottom=0.01, hspace=1.5, wspace=0.4)
Run Code Online (Sandbox Code Playgroud)
有一些非常极端的价值观.hspace是子图之间的垂直间隙(最可能以子图高度为单位).
Figure有相同的subplots_adjust方法,所以你可以决定选择哪一个.
| 归档时间: |
|
| 查看次数: |
3811 次 |
| 最近记录: |