首页 > 技术文章 > AttributeError: 'AxesSubplot' object has no attribute 'savefig'错误解决方法

ech2o 原文

子图没有'savefig'这个方法

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

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

推荐阅读