Python:标题在两轴之上,但不在图之上

Python: title above two axes, but not above figure

我正在寻找类似于 plt.subtitle() 的东西,它将 "main title" 放在我选择的两个网格中的子图上方。在我的情节中,标题 Development of model parameterFinal model parameter 应该类似于两个轴的主标题。有那个功能吗?或者顺利的解决方法?

一种方法是为常用图表创建一个不可见的轴,并仅使用该轴的标题:

import numpy as np
import matplotlib.pyplot as plt

#function for display
def f(t, a, b, c):
    return np.exp(a - t) * np.sin(b * t + c)

fig = plt.figure()

x = np.linspace(0, 10, 1000)
#curve 1
ax1 = fig.add_subplot(211)
ax1.plot(x, f(x, 5, 1, 0))
ax1.set_title("Curve 1")
#create common axis for curve 2 and 3, remove frame and ticks, set title 
ax23 = fig.add_subplot(223, frameon = False)
ax23.set_xticks([])
ax23.set_yticks([])
ax23.set_title("Curve 2 and 3 together")
#create curve 2
ax2 = fig.add_subplot(245)
ax2.plot(x, f(x, 0, 3, 0))
#create curve 3
ax3 = fig.add_subplot(246)
ax3.plot(x, f(x, 2, 1, 7))
#create curve 4
ax4 = fig.add_subplot(224)
ax4.plot(x, f(x, -1, 3, -3))
ax4.set_title("Curve 4")
#display
plt.show()

输出