Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Troubles after updating ipython (%matplotlib nbagg)

I installed anaconda distro, I usualy run ipython notebook --pylab inline. I updated ipython using pip install (windows 8.1) and I don't have to write --pylab inline to start anymore

I started writing in the cell: %matplotlib nbagg or matplotlib.use['nbagg'], but when I plot something it shows this empty box: enter image description here

I was expecting the interactive plotting box.

The ipython log shows:

[IPKernelApp] ERROR | No such comm: 7cfe982045bb4d0db0f14deff7258130
like image 375
nandhos Avatar asked Mar 14 '15 02:03

nandhos


People also ask

What happens if I dont use %Matplotlib inline?

It just means that any graph which we are creating as a part of our code will appear in the same notebook and not in separate window which would happen if we have not used this magic statement.

Do We Still Need %Matplotlib inline?

So %matplotlib inline is only necessary to register this function so that it displays in the output. Running import matplotlib. pyplot as plt also registers this same function, so as of now it's not necessary to even use %matplotlib inline if you use pyplot or a library that imports pyplot like pandas or seaborn.

What can I use instead of %Matplotlib inline?

show() . If you do not want to use inline plotting, just use %matplotlib instead of %matplotlib inline .

Why Do We Need %Matplotlib inline?

Why matplotlib inline is used. You can use the magic function %matplotlib inline to enable the inline plotting, where the plots/graphs will be displayed just below the cell where your plotting commands are written. It provides interactivity with the backend in the frontends like the jupyter notebook.


2 Answers

I guess this issue is caused by a too old version of matplotlib. Using %matplotlib nbagg with ipython>=3.0 requires matplotlib>=1.4.3 (Note that %matplotlib notebook and %matplotlib nbagg are now synonyms).

Updating matplotlib via pip install --upgrade matplotlib will probably fix this issue. See also my issue-7797 on github. Thanks to jenshnielsen for this information.

like image 119
cel Avatar answered Sep 18 '22 09:09

cel


Should update both matplotlib and ipython...

sudo pip install -U ipython
sudo pip install -U matplotlib

on windows:

pip install --upgrade matplotlib
pip install --upgrade ipython
like image 30
Ziang Yan Avatar answered Sep 19 '22 09:09

Ziang Yan