我希望调整子图之间的水平间距,特别是在每第二行之间。我可以使用fig.subplots_adjust(hspace=n)
来调整每一行,但是是否可能将其应用于每第二行?
import matplotlib.pyplot as plt
fig, ax = plt.subplots(figsize = (10,10))
plt.style.use('ggplot')
ax.grid(False)
ax1 = plt.subplot2grid((5,2), (0, 0))
ax2 = plt.subplot2grid((5,2), (0, 1))
ax3 = plt.subplot2grid((5,2), (1, 0))
ax4 = plt.subplot2grid((5,2), (1, 1))
ax5 = plt.subplot2grid((5,2), (2, 0))
ax6 = plt.subplot2grid((5,2), (2, 1))
ax7 = plt.subplot2grid((5,2), (3, 0))
ax8 = plt.subplot2grid((5,2), (3, 1))
fig.subplots_adjust(hspace=0.9)
使用下面的子图,我希望在第2行和第3行之间添加一个空格,并保持其余部分不变。
![enter image description here](https://istack.dev59.com/EW6iQ.webp)
hspace
,根据官方文档,hspace的目的是调整每一行之间的空间,要实现每隔两行相同功能但不同的设置,你需要自己寻找合适的方法。 - user2906838