Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Closed
Milestone
Description
Bug summary
I tried to pickle figures with subfigures nested.
Returns error with the following code.
Code for reproduction
#!/usr/bin/env python3importpickleimportmatplotlib.pyplotaspltfig=plt.figure()subfigs=fig.subfigures(2,2)withopen('fig.p','wb')asfile:pickle.dump(fig,file)
Actual outcome
---------------------------------------------------------------------------TypeError Traceback (most recent call last)Cell In[1], line 8 6 subfigs = fig.subfigures(2,2) 7 with open('fig.p', 'wb') as file:----> 8 pickle.dump(fig, file)TypeError: cannot pickle 'FigureCanvasQTAgg' object
Expected outcome
A pickle file should be saved to the working directory.
Additional information
I know the API is still provisional but I couldn't find other reports so I decided to post.
I believe this is caused by the "subfigures" API, as skipping that line makes the script work.
It's my first time to report a issue, so I'm a bit worried if I'm doing things right.
Operating system
Windows 10
Matplotlib Version
3.9.0
Matplotlib Backend
qtagg
Python version
3.12.1
Jupyter version
No response
Installation
pip
Metadata
Metadata
Assignees
Labels
No labels