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.
/.ipython/ipython_config.pyor/.ipython/ipython_kernel_config.pycontains a line stating to use qt4.%matplotlib qt5. Second, I need to runipython profile createin cmd to create those two files you mentioned. But the contents in these newly created files are all commented. I'm curious if you have any insight why this step is still necessary