Matplotlib savefig falls down working in notebook backend

Viewed 224

In Jupyter notebook matplolib fails to save figure. MVE:

from matplotlib import pyplot as plt
%matplotlib notebook
fig, ax = plt.subplots()
fig.savefig("1.png")

Produces:

AttributeError                            Traceback (most recent call last)
/usr/lib/python3.8/site-packages/matplotlib/backend_bases.py in _wait_cursor_for_draw_cm(self)
   2772             try:
-> 2773                 self.set_cursor(cursors.WAIT)
   2774                 yield

/usr/lib/python3.8/site-packages/matplotlib/backends/backend_webagg_core.py in set_cursor(self, cursor)
    380         if cursor != self.cursor:
--> 381             self.canvas.send_event("cursor", cursor=cursor)
    382         self.cursor = cursor

/usr/lib/python3.8/site-packages/matplotlib/backends/backend_webagg_core.py in send_event(self, event_type, **kwargs)
    345     def send_event(self, event_type, **kwargs):
--> 346         self.manager._send_event(event_type, **kwargs)
    347 

AttributeError: 'NoneType' object has no attribute '_send_event'

While everything works fine in non-interactive %matplotlib inline. Matplotlib : 3.2.0, ipython : 7.13.0. Any ideas how to fix this?

Thanks

0 Answers
Related