Skip to content Skip to sidebar Skip to footer

Cannot Manually Close Matplotlib Plot Window

I'm running Python v2.7 and matplotlib v1.5.0 on Mac OS X Yosemite. Up to recently, I was able to run my script in the interactive interpreter, show a plot, and then manually kill

Solution 1:

For a permanent solution (I'd rather not have to switch backends every time I open ipython) you can modify matplotlibrc.

There are various matplotlibrc files that can be changed (i.e. for just a local directory, or globally, etc.). To find the configuration file that's been loaded for your ipython session, use matplotlib.matplotlib_fname(). Here's what I got:

In [1]: import matplotlib

In [2]: matplotlib.matplotlib_fname()
Out[2]: u'/usr/local/lib/python2.7/site-packages/matplotlib/mpl-data/matplotlibrc'

Opening the rc file and changing the line:

backend      :macosx

to read:

backend      :Qt4Agg

did the trick for me.

Solution 2:

I solved the problem by switching the interactive backend. Either Qt4Agg or TkAgg as an interactive backend resolves the issue.

Post a Comment for "Cannot Manually Close Matplotlib Plot Window"