When I plot using the TkAgg backend in interactive mode, the figure is unresponsive, though the data shows itself in that figure if I open a new figure.
Code for reproduction
importmatplotlib.pyplotaspltplt.ion()
frommatplotlib.backends.backend_qt5aggimportFigureCanvasQTAggasFigureCanvasplt.figure()
plt.plot([1], 'ko') # plot a point
Actual outcome
The figure is unresponsive and blank, and the Mac spinning beachball symbol shows if I hover the cursor over it.
Expected outcome
The figure is plotted and responsive.
Matplotlib version
Matplotlib version 2.0.0.
python info:
Python 3.5.2 |Anaconda custom (x86_64)| (default, Jul 2 2016, 17:52:12)
[GCC 4.2.1 Compatible Apple LLVM 4.2 (clang-425.0.28)] on darwin
If the former I suspect that importing pyqt replaced the input hook from tk with the one from qt (for some more details see #4779 ). You may be able to track down how Tk sets up it's input hook and re-install it, but in general you should not expect multiple GUI frameworks to play nice in the same interactive session. The simplest solution is to just switch to using the Qt5 backend.
Switching backends isn't really an option. Qt4 is apparently used with matplotlib when installed by anaconda on a mac, and using Qt5 and Qt4 together seems to be discouraged, so Qt5 probably isn't an option. As for other backends, I'm having separate issues with Qt4 and MacOSX.
Qt4 is just used by default because that's the setting the conda packagers gave it by default. You can use Qt5 pretty easily by updating conda install qt=5 and then modifying your matplotlibrc to set the Qt5Agg backend instead.
Just trying "conda install qt=5" gave me a package dependency error, so I ended up reinstalling anaconda, which happened to update it to python 3.6. I can now use Qt5, and I don't seem to have issues with it.
Activity
tacaswell commented on Mar 30, 2017
Are you using plain python or IPython?
If the former I suspect that importing pyqt replaced the input hook from tk with the one from qt (for some more details see #4779 ). You may be able to track down how Tk sets up it's input hook and re-install it, but in general you should not expect multiple GUI frameworks to play nice in the same interactive session. The simplest solution is to just switch to using the Qt5 backend.
js54434 commented on Mar 30, 2017
I'm using plain python.
Switching backends isn't really an option. Qt4 is apparently used with matplotlib when installed by anaconda on a mac, and using Qt5 and Qt4 together seems to be discouraged, so Qt5 probably isn't an option. As for other backends, I'm having separate issues with Qt4 and MacOSX.
QuLogic commented on Mar 31, 2017
Qt4 is just used by default because that's the setting the conda packagers gave it by default. You can use Qt5 pretty easily by updating conda install qt=5 and then modifying your matplotlibrc to set the Qt5Agg backend instead.
js54434 commented on Mar 31, 2017
Just trying "conda install qt=5" gave me a package dependency error, so I ended up reinstalling anaconda, which happened to update it to python 3.6. I can now use Qt5, and I don't seem to have issues with it.
tacaswell commented on Mar 31, 2017
Great, closing this as resolved.