gpt4 book ai didi

Matplotlib:重新打开一个封闭的图形?

转载 作者:行者123 更新时间:2023-12-04 02:29:11 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





Matplotlib: how to show a figure that has been closed

(1 个回答)


去年关闭。




是否可以在 matplotlib 中重新打开一个封闭图形(即用户 X'd 中的一个)?以下代码显示了幼稚的方法:

In [14]: fig = figure(10)

In [15]: close(fig)

In [16]: fig.show()

Exception in Tkinter callback
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 1410, in __call__
return self.func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-tk/Tkinter.py", line 495, in callit
func(*args)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 253, in idle_draw
self.draw()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/backend_tkagg.py", line 239, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/matplotlib/backends/tkagg.py", line 19, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
TclError: this isn't a Tk application

我正在尝试创建一个带有小部件的图形,因此可以使用一种解决方法(只需创建一个新图形),但我想知道 figure 是否可用实例关闭后完全没用。

最佳答案

是的,关闭图形会将其完全删除。

关于Matplotlib:重新打开一个封闭的图形?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9621017/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com