Python 第一个标题不是';不显示(Matplotlib)

Python 第一个标题不是';不显示(Matplotlib),python,matplotlib,Python,Matplotlib,我尝试添加标题,但第一行并没有显示 fig = plt.figure() ax1 = fig.add_subplot(121, title="Lines") ax2 = fig.add_subplot(122, title="Points") men = Myclass(m, s, t, a) total_i = 0 i = 0 ani = animation.FuncAnimation(fig, men.calculate, interval=1) plt.show() 我尝试使用“ax

我尝试添加标题,但第一行并没有显示

fig = plt.figure()
ax1 = fig.add_subplot(121, title="Lines")
ax2 = fig.add_subplot(122, title="Points")

men = Myclass(m, s, t, a)

total_i = 0
i = 0
ani = animation.FuncAnimation(fig, men.calculate, interval=1)
plt.show()
我尝试使用“ax1.title.set_text(“行”),但没有任何帮助

男人们,算算:


很好。你能展示一下你的代码和输出吗

import matplotlib.pyplot as plt 
%matplotlib inline

fig = plt.figure()
ax1 = fig.add_subplot(121, title="Lines")
ax2 = fig.add_subplot(122, title="Points")

ax1.plot(list(range(10)), list(range(10)))
ax2.plot(list(range(10)), list(reversed(range(10))))

需要添加动画功能:

ax1.title.set_text("Lines")
ax2.title.set_text("Points")
之后:

ax1.clear()
ax2.clear()

当我运行这段代码时,两个标题都会显示出来。你能告诉我们你运行了哪些行以及输出的屏幕截图吗?我明白了。是否可以为这个示例提供一些测试数据,以便我们可以尝试一下?
ax1.clear()
ax2.clear()