Matplotlib figure does not close after being resurrected

烈酒焚心 提交于 2019-12-24 01:57:21

问题


Try the following code:

import matplotlib.pyplot as plt
fig = plt.figure() #creates a pyplot figure
plt.close(fig) #closes the figure
fig.show() #resurrects the figure, that is, displays it
plt.close(fig) #should close the figure, but does nothing

My questions are:

  1. why does not the last line of code close the figure ?

  2. how to get the figure closed anyway (programmatically) after it has been resurrected as above ?

来源:https://stackoverflow.com/questions/35300855/matplotlib-figure-does-not-close-after-being-resurrected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!