Not working with iPython/Jupyter
See original GitHub issuePython 3.5.0 |Anaconda 2.4.0 (x86_64)| (default, Oct 20 2015, 14:39:26) [GCC 4.2.1 (Apple Inc. build 5577)]
I tried the first code example in a Jupyter/iPython notebook cell:
import matplotlib.pyplot as plt
import numpy as np
from mpldatacursor import datacursor
data = np.outer(range(10), range(1, 5))
fig, ax = plt.subplots()
lines = ax.plot(data)
ax.set_title('Click somewhere on a line')
datacursor(lines)
plt.show()
I’ve run pip install mpldatacursor
and done kernel -> restart
from Jupyter notebook.
Executing the cell, the plot displays correctly but it is noninteractive. Clicking a line does not do anything.
EDIT: just found https://github.com/joferkington/mpldatacursor/issues/12
Adding %matplotlib nbagg
does produce something working, although it gives the error:
/Users/pi/anaconda/lib/python3.5/site-packages/IPython/kernel/init.py:13: ShimWarning: The IPython.kernel
package has been deprecated. You should import from ipykernel or jupyter_client instead.
- “You should import from ipykernel or jupyter_client instead.”, ShimWarning)*
Issue Analytics
- State:
- Created 8 years ago
- Comments:17 (5 by maintainers)
Top Results From Across the Web
What to do when things go wrong - The Jupyter Notebook
Jupyter doesn't load or doesn't work in the browser · Try in another browser (e.g. if you normally use Firefox, try...
Read more >Jupyter notebook not running code. Stuck on In [*]
Go to the folder where you have your ipython notebook(.ipynb) · Press shift and right click on the empty space then select "open...
Read more >Jupyter / IPython: After editing a module, changes are not ...
There are several ways to work around this issue. 1) The simplest and most certain is to restart the ipython kernel after changing...
Read more >Jupyter Notebook is not showing the output of any code ...
Hello, I am new to python. When I use Jupyter Notebook the code inside the cells won't execute and I get these empty...
Read more >The IPython Notebook — IPython 3.2.1 documentation
Introduction¶. The notebook extends the console-based approach to interactive computing in a qualitatively new direction, providing a web-based application ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What backend are you using?
You’ll have to use
%matplotlib nbagg
to have interactive figures in an IPython notebook.Otherwise, the
inline
backend generates static .png’s. There’s no way for any interaction to happen with the the inline backned.PS Could this
%matplotlib nbagg
information be provided in the main readme, under the setup section? A lot of iPython/Jupyter users out there now…