I need to create scientific plots with matplotlib
in Jupyter notebook, and create them in separate windows instead of inline. I ran %matplotlib qt
and got this error: ImportError: No module named PyQt4
A lot of related answers on the internet involves installing PyQt4. To give some background information, I use Anaconda to manage python modules on a Windows machine. Anaconda installs PyQt5.6.0 in its root environment by default. Downgrading this package to PyQt4 will solve the problem, however, another module in my project depends on PyQt5. I want to figure out how use matplotlib with PyQt5.
According to matploblib's tutorial, it supports PyQt5 backend. I tried to run matplotlib.rcParams['backend'] = "Qt5Agg"
and matplotlib.use('Qt5Agg')
before the %matplotlib qt
, but got same error. Am I missing something that's so obvious to others? Helps are appreciated.