Skip to content

ipywidgets with v3.3x #18741

Closed
Closed
@prisae

Description

@prisae

Bug report

Bug summary

Interactive code (Jupyter Notebook using %matplotlib notebook) worked up to v3.2.x, stops working for v3.3.x. Tested on Firefox and Chrome.

Code for reproduction

import ipywidgets as widgets
import matplotlib.pyplot as plt
from IPython.display import display

%matplotlib notebook

class MWE:

    def __init__(self):
        self.fig, self.ax = plt.subplots(1, 1)
        self.ax.set_xlim([-5, 105])
        self.ax.set_ylim([-500, 10500])
        self.create_widget()
        self.draw()

    def create_widget(self):
        value = widgets.interactive(
            self.update_value,
            value=widgets.IntSlider(value=50, min=0, max=100))
        display(value)

    def draw(self):
        self.ax.plot(self.value, self.value**2, 'o')

    def update_value(self, value):
        self.value = value
        self.draw()

MWE()

Actual outcome
Just an empty figure, moving the slider has no effect, no warning thrown either.

Expected outcome
More and more dots should be printed when moving the slider.

Matplotlib version

  • Operating system: Ubuntu 20.04
  • Matplotlib version: <3.2.x works, >=3.3.2 does not.
  • Matplotlib backend: nbAgg
  • Python version: 3.8.6
  • Jupyter version (if applicable): 1.0.0
  • Other libraries: widgets v7.5.1

Installed with mamba from conda-forge.

It might be related to #18481, but it happens for Firefox and Chrome on my machine. Also, the mentioned workaround (#18481 (comment)) does not help.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions