subplot上下间距
时间: 2023-10-13 17:08:20 浏览: 80
可以通过设置subplot之间的间距来控制上下间距,可以使用subplot_adjust()函数来实现,例如:
```
import matplotlib.pyplot as plt
fig, axs = plt.subplots(2, 1)
axs[0].plot([1, 2, 3], [4, 5, 6])
axs[1].plot([1, 2, 3], [6, 5, 4])
plt.subplots_adjust(hspace=0.5) # 设置上下间距为0.5
plt.show()
```
这里的hspace参数控制上下间距,值越大,间距越大。