matplotlib / matplotlib/ipympl

ipympl not working nicely with interact

Open
#36 10 comments 1 reaction 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
1.7k
Forks
234
PR merge metrics
No merged PRs in 30d

Description

Trying to follow some simple examples of Jupyter widgets with matplotlib, but I'm having issues when using the `ipympl` backend. The first update to a plot produces a second plot (overplotted), and the second update just erases the figure window altogether. This does not happen when using `inline`.

Here's some simple code to reproduce the issue:

%matplotlib ipympl
import matplotlib.pyplot as plt
from ipywidgets import interact

def f(n):
plt.plot([0,1,2],[0,1,n])
plt.show()
interact(f,n=(0,10));

If I use `inline`, this will update the line plot. With `ipympl` it fails.

I am using ipympl 0.1.0 from Anaconda, together will other packages:

ipywidgets 7.0.0 py36_intel_0 [intel] intel
ipympl 0.1.0 py36_1 conda-forge
matplotlib 2.0.2 np113py36_intel_1 [intel] intel
ipython 6.1.0 py36_intel_0 [intel] intel
jupyter 1.0.0 py36_intel_5 [intel] intel
jupyter_client 5.1.0 py36_intel_0 [intel] intel
jupyter_console 5.1.0 py36_intel_0 [intel] intel
jupyter_core 4.3.0 py36_intel_1 [intel] intel

Contributor guide

Open the contributing guide

Research direction

Run the supplied ipympl and interact reproducer, then compare its figure-update behavior with the inline backend. Trace the ipympl backend and widget update path involved in repeated interact calls; done means updates keep one plot visible without erasing the figure.

Written by the indexing model from the issue text.

Assessment

Tech stack
jupyter, jupyter-notebook, python
Domain
data-visualization, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.