ipython: prompt_toolkit breaks matplotlib
I have been experimenting with the ipython 5 release candidates and I like it a lot. Until I try to make some plots and visualize it.
As a test I run:
import matplotlib.pyplot as plt; plt.ion(); plt.plot([1, 2])
In ipython 4.2.0 it shows a very nice plot, while in 5.0.0rc4 the plot window fires up but it just contains the lines of my konsole below the window:
Git bisects indicate the following:
67d7c405d3ee45570b44d4c37a5c23b5f21068d8 is the first bad commit commit 67d7c405d3ee45570b44d4c37a5c23b5f21068d8 Author: Thomas Kluyver thomas@kluyver.me.uk Date: Mon Feb 22 17:02:41 2016 +0000
Switch over to use prompt_toolkit in IPython
:040000 040000 716f84bf64b295c05b6394d096f3d031c446a1fa 5a9f49fcaa2b77fb872c166afe53f69f38897344 M IPython :100755 100755 c16bd1d1ed4817707bdac7b1cc85587e4675e47c fe58b5fd2723aca2d6d334eddef96f8d0df9a1ab M setup.py
I have matplotlib to use qt5agg as backend. I am on OpenSUSE Tumbleweed, with qt5 5.6.0-1.2
If I use qt4 as backend, the commit before the above works and 67d7c405d3ee45570b44d4c37a5c23b5f21068d8 don’t even show the figure window
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 26 (24 by maintainers)
Closing as it mostly seems to be solved by using the
%matplotlib
magic, which was always recommended. matplotlib/matplotlib#6734 should make that unnecessary with matplotlib 2.If there are still problems you’re encountering, please find or file separate issues about those so we can debug them.
notebook
is only for the notebook,inline
can work in other Jupyter frontends. However, I was making a distinction between IPython running as a kernel (for Jupyter frontends) and IPython running in the terminal, which is what’s in question here.@tacaswell : thank you very much for the detailed explanation.
I’m wondering how many people don’t use the
%matplotlib
magic, because up to now plotting just works. If there are more than a handful of people like me, will be annoying for the users, that will have to remember to type the magic command before importing matplotlib, and for the developers, that will have to go through issues like this one countless times.