【问题标题】:How to create a figure where one axis is placed between and under 2 aligned axes?如何创建一个轴位于 2 个对齐轴之间和下方的图形?
【发布时间】:2022-07-03 16:02:27
【问题描述】:
【问题讨论】:
标签:
python
matplotlib
customization
axes
【解决方案1】:
可以说,实现这一目标的最简单方法是使用GridSpec:
import matplotlib.pyplot as plt
from matplotlib.gridspec import GridSpec
gs = GridSpec(3, 4)
fig = plt.figure(tight_layout=True)
ax1 = fig.add_subplot(gs[0, :2])
ax2 = fig.add_subplot(gs[0, 2:])
ax3 = fig.add_subplot(gs[1, :2])
ax4 = fig.add_subplot(gs[1, 2:])
ax5 = fig.add_subplot(gs[2, 1:-1])