其他分享
首页 > 其他分享> > plt.close()不work

plt.close()不work

作者:互联网

成功解决plt.close()不work

原因:

Remember that plt.show() is a blocking function, so in the example code you used above, plt.close() isn't being executed until the window is closed, which makes it redundant.
You can use plt.ion() at the beginning of your code to make it non-blocking, although this has other implications.

解决方案:

在作图代码前加上plt.ion(),成功解决。

reference:

https://stackoverflow.com/questions/20401057/matplotlib-close-does-not-close-the-window

标签:code,work,ion,window,plt,close,blocking
来源: https://www.cnblogs.com/blog-joy/p/14303605.html