-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
[Bug]: matplotlib==3.5.2 breaks ipywidgets #23229
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
If you add a Can you try editing your post, the layout markup is not quite right. |
Yes it works again with |
@TomBugnon in general I would try to avoid mixing In your case you can just include the |
xref matplotlib/ipympl#469 and this should be fixed by #23057 |
I think I'm experiencing the same issue. A downgrade to 3.5.1 resolves the issue for me, but I'm not using "widget", I'm using the "qt" backend. I've been using matplotlib + terminal IPython for whats coming close to a decade, so I'm not doing any fancy new Jupyter notebook stuff. I just open my terminal and start making figures. The following code when pasted into IPython breaks for me on matplotlib 3.5.2: import matplotlib as mpl
import IPython
ipython = IPython.get_ipython()
ipython.run_line_magic('matplotlib', 'qt')
backend = 'Qt5Agg'
mpl.use(backend)
from matplotlib import pyplot as plt
import numpy as np
img1 = np.random.rand(128, 128)
img2 = img1.copy()
img2[:, 0:64] = 0
# Showing the initial image works fine.
plt.imshow(img1)
# Should update the previous figure to show a new image
plt.imshow(img2) Hopefully the patch fixes this case too, but I figure I'd comment because this MWE is a bit simpler than the previous and might be easier to integrate into a regression test. Tested on CPython 3.10.5 with IPython 8.4.0, and CPython 3.9.9 with IPython 8.3.0 in Ubuntu 22.04, all installed via pyenv and pip. |
@Erotemic please open a new issue explaining exactly what has broken for you. |
Bug summary
After updating matplotlib to 3.5.2 (from 3.5.1) the display/updating of widgets created with ipywidgets is broken, at least for certain types of plots.
Update of print statements in response to moving the widgets works fine but the plot is not modified.
To reproduce:
requirements.txt
:conda create python=3.7 --name myenv & conda activate myenv & pip install -r requirements.txt
Code for reproduction
Actual outcome
Print statements follow the widgets, not the figure
Expected outcome
When pinning matplotlib version to 3.5.1, both the print statement and the figure follow the widgets
Additional information
This doesn't happen for all types of figures/widgets.
I'm at a loss as to why, but this snippet works fine for me for both versions
I had the same behavior on python3.7 and 3.10, and on VSCode jupyter and jupyter notebook.
conda == 4.11.0
Operating system
Ubuntu
Matplotlib Version
3.5.2
Matplotlib Backend
module://ipympl.backend_nbagg
Python version
3.10.4
Jupyter version
6.4.12
Installation
pip
The text was updated successfully, but these errors were encountered: