子图没有'savefig'这个方法

可以利用 matplotlib.pyplot 中的 gcf() 方法(get current figure)获得当前的figure:

fig = plt.gcf()
fig.savefig('output.png')

 

相关文章: