Идея состоит в том, чтобы создать три «больших подзаголовка», дать каждому из них название и сделать их невидимыми. В верхней части этого вы можете создать свою матрицу меньших подзаговоров.
Это решение полностью основано на этой записи , за исключением того, что больше внимания уделяется фактическому удалению фонового подзадачи .
[/g1]
import matplotlib.pyplot as plt
fig, big_axes = plt.subplots( figsize=(15.0, 15.0) , nrows=3, ncols=1, sharey=True)
for row, big_ax in enumerate(big_axes, start=1):
big_ax.set_title("Subplot row %s \n" % row, fontsize=16)
# Turn off axis lines and ticks of the big subplot
# obs alpha is 0 in RGBA string!
big_ax.tick_params(labelcolor=(1.,1.,1., 0.0), top='off', bottom='off', left='off', right='off')
# removes the white frame
big_ax._frameon = False
for i in range(1,10):
ax = fig.add_subplot(3,3,i)
ax.set_title('Plot title ' + str(i))
fig.set_facecolor('w')
plt.tight_layout()
plt.show()