Closed
Description
Describe the issue
When trying to save png figures with ipympl, interactive widgets, and the latest matplotlib (3.3.0), the saving fails with the following error message:
import matplotlib
matplotlib.use('module://ipympl.backend_nbagg')
from matplotlib import pyplot as plt
fig = plt.figure()
fig.savefig('test.png')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-c4b3ac84131c> in <module>
6 from matplotlib import pyplot as plt
7 fig = plt.figure()
----> 8 fig.savefig('test.png')
/usr/local/lib/python3.8/dist-packages/matplotlib/figure.py in savefig(self, fname, transparent, **kwargs)
2309 patch.set_edgecolor('none')
2310
-> 2311 self.canvas.print_figure(fname, **kwargs)
2312
2313 if transparent:
/usr/local/lib/python3.8/dist-packages/matplotlib/backend_bases.py in print_figure(self, filename, dpi, facecolor, edgecolor, orientation, format, bbox_inches, pad_inches, bbox_extra_artists, backend, **kwargs)
2223 self.figure.set_edgecolor(origedgecolor)
2224 self.figure.set_canvas(self)
-> 2225 return result
2226
2227 @classmethod
/usr/lib/python3.8/contextlib.py in __exit__(self, type, value, traceback)
118 if type is None:
119 try:
--> 120 next(self.gen)
121 except StopIteration:
122 return False
/usr/local/lib/python3.8/dist-packages/matplotlib/cbook/__init__.py in _setattr_cm(obj, **kwargs)
2064 for attr, orig in origs.items():
2065 if orig is sentinel:
-> 2066 delattr(obj, attr)
2067 else:
2068 setattr(obj, attr, orig)
AttributeError: __delete__
Saving figures as pdf
or png
figures with an older Matplotlib version (3.2.0) works well.
Versions
Matplotlib version: 3.3.0
python -c "import sys; print('\n',sys.version); import ipympl; print('ipympl version:', ipympl.__version__)" && jupyter --version && jupyter nbextension list && jupyter labextension list
-->
3.8.5 (default, Jul 20 2020, 18:32:44)
[GCC 9.3.0]
ipympl version: 0.5.7
jupyter core : 4.6.3
jupyter-notebook : 6.0.3
qtconsole : 4.7.4
ipython : 7.16.1
ipykernel : 5.3.4
jupyter client : 6.1.6
jupyter lab : 2.2.2
nbconvert : 5.6.1
ipywidgets : 7.5.1
nbformat : 5.0.7
traitlets : 4.3.3
Known nbextensions:
config dir: /usr/etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension disabled
config dir: /usr/local/etc/jupyter/nbconfig
notebook section
bqplot/extension enabled
- Validating: OK
itkwidgets/extension enabled
- Validating: OK
jupyter-datawidgets/extension enabled
- Validating: OK
jupyter-leaflet/extension enabled
- Validating: OK
jupyter-matplotlib/extension enabled
- Validating: OK
jupyter-js-widgets/extension enabled
- Validating: OK
config dir: /etc/jupyter/nbconfig
notebook section
jupyter-js-widgets/extension enabled
- Validating: OK
JupyterLab v2.2.2
Known labextensions:
app dir: /usr/local/share/jupyter/lab
@jupyter-widgets/jupyterlab-manager v2.0.0 enabled OK
@jupyterlab/hub-extension v2.0.2 enabled OK
jupyter-matplotlib v0.7.3 enabled OK
jupyterlab-datawidgets v6.3.0 enabled OK
Metadata
Metadata
Assignees
Labels
No labels