Description
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
channelconda-forge