question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not working with iPython/Jupyter

See original GitHub issue

Python 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:open
  • Created 8 years ago
  • Comments:17 (5 by maintainers)

github_iconTop GitHub Comments

13reactions
joferkingtoncommented, Nov 10, 2015

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.

1reaction
p-i-commented, Nov 10, 2015

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found