Python Matplotlib hangs when asked to plot a second chart (after closing first chart window)

后端 未结 6 1085
不知归路
不知归路 2021-02-14 18:09

Weird behaviour, I\'m sure it\'s me screwing up, but I\'d like to get to the bottom of what\'s happening:

I am running the following code to create a very simple graph

6条回答
  •  走了就别回头了
    2021-02-14 18:44

    I had this problem when using TkAgg as the backend. After using plt.close('all') my computer froze.

    The solution was to switch to a different backend. I now use Qt4Agg instead.

    If you have Qt4Agg installed it is possible to switch backends by typing:

    plt.switch_backend('Qt4Agg')
    

    before plotting data

提交回复
热议问题