简体   繁体   English

plt.close('all') Python 在 Spyder 中不起作用

[英]plt.close('all') Python not working in Spyder

I have been trying to close all graphs at the beginning of my code in Spyder using Python, however I did not come up with a solution.我一直在尝试使用 Python 在 Spyder 中的代码开头关闭所有图表,但是我没有想出解决方案。 I have searched several ways to do it, however none worked, included the coded especified by matplotlib.我已经搜索了几种方法来做到这一点,但是没有一个有效,包括 matplotlib 指定的编码。 https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.close.html https://matplotlib.org/3.1.1/api/_as_gen/matplotlib.pyplot.close.html

import matplotlib.pyplot as plt
plt.show(block=False)
plt.pause(3)
plt.close('all')

I am wondering if it is a Spyder bug.我想知道它是否是 Spyder 错误。

Does anybody have a clue of what can i try to do?有人知道我可以尝试做什么吗?

I tried the solution mentioned here: https://github.com/spyder-ide/spyder/issues/5350 and i tried the one you described, but it didn't work for me either.我尝试了这里提到的解决方案: https://github.com/spyder-ide/spyder/issues/5350我尝试了你描述的那个,但它也对我不起作用。

I guess it would be the best to use the shortcut "ctrl+shift+w" before executing your code.我想在执行代码之前最好使用快捷键“ctrl+shift+w”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM