Skip to content

matplotlib>=3.3.2 breaks ipywidgets.interact #18638

@casperdcl

Description

@casperdcl

Bug report

Bug summary

Using ipywidgets.interact to update a figure works as expected in matplotlib<=3.3.1, but fails in matplotlib==3.3.2.

I don't think this is an ipywidgets issue since downgrading matplotlib fixes this issue.

Code for reproduction

In[1]:

%matplotlib notebook
import matplotlib as mpl
import matplotlib.pyplot as plt
import ipywidgets as ipyw
"works if %s <= 3.3.1" % mpl.__version__

In[2]:

fig = plt.figure()
@ipyw.interact(m=ipyw.FloatSlider(value=1, min=-10, max=10, step=0.01))
def update(m):
    plt.figure(fig.number, clear=True)
    plt.plot([m * x for x in range(-9, 10)])

Followed by moving the slider.

Actual outcome

  • when moving the slider, the figure does not update
  • a second figure is sometimes created instead
  • the second figure is usually blank, but sometimes updates instead

Expected outcome

  • the original figure updates as it does in matplotlib==3.3.1

Matplotlib version

  • Operating system: Ubuntu
  • Matplotlib version: 3.3.2 vs 3.3.1
  • Matplotlib backend (print(matplotlib.get_backend())): nbAgg
  • Python version: 3.7.8
  • Jupyter version (if applicable): jupyter-core==4.6.3
  • Other libraries: ipywidgets==7.5.1
  • Installation source: conda channel conda-forge

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy