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

后端 未结 6 1103
不知归路
不知归路 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:31

    Three months late to the party, but I found a suggestion in the matlibplot documentation to use draw() rather than show(); the former apparently just does a render of the current plot, while the latter starts up all the interactive tools, which is where the problems seem to start.

    It's not terribly prominently placed in the documentation, but here's the link: http://matplotlib.sourceforge.net/faq/howto_faq.html#use-show

    For what it's worth, I've tried pylab.show() and had exactly the same issue you did, while pylab.draw() seems to work fine if I just want to see the output.

提交回复
热议问题