问题
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:
why does not the last line of code close the figure ?
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