Skip to content

ipympl not working nicely with interact #36

Open
@tiagopereira

Description

@tiagopereira

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions