Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: figure with subfigures cannot be pickled #28464

Closed
Milestone
@PerfectNewbie

Description

@PerfectNewbie

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp