我有一个3x3的网格,包含9个子图,每个子图都有一个标题。我想为每一行添加一个标题。为此,我考虑使用suptitle。但问题是,如果我使用3个suptitle,它们似乎会被覆盖,只有最后一个会显示。
以下是我的基本代码:
以下是我的基本代码:
fig, axes = plt.subplots(3,3,sharex='col', sharey='row')
for j in range(9):
axes.flat[j].set_title('plot '+str(j))
plt1 = fig.suptitle("row 1",x=0.6,y=1.8,fontsize=18)
plt2 = fig.suptitle("row 2",x=0.6,y=1.2,fontsize=18)
plt3 = fig.suptitle("row 3",x=0.6,y=0.7,fontsize=18)
fig.subplots_adjust(right=1.1,top=1.6)
j%3 == 1
)的标题并清除其余部分呢? - wflynnysuptitle
。我建议使用text
对象作为行标题。 - tmdavison