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

Figure cannot be closed if it has associated Agg canvas #18163

Closed
Milestone
@malfet

Description

@malfet

Bug report

** plt.fignum_exists() returns True after figure is closed**

Code snippet below closes figure after creatingFigureCanvasAgg, and it works with matplotlib-3.2.1 but fails with matplotlib-3.3.0

Code for reproduction

importmatplotlibmatplotlib.use('Agg')importmatplotlib.pyplotaspltfigure=plt.figure()plt.axis('scaled')plt.tight_layout()matplotlib.backends.backend_agg.FigureCanvasAgg(figure)plt.close(figure)print("Matplotlib version:",matplotlib.__version__)assertplt.fignum_exists(figure.number)==False

Actual outcome

Matplotlib version: 3.3.0Traceback (most recent call last):  File "figure_exists.py", line 11, in <module>    assert plt.fignum_exists(figure.number) == FalseAssertionError

Expected outcome
No assertion, which is easy to reproduce if one to downgrade to matplotlib-3.2.1:

 pip3 install matplotlib==3.2.1 --user; python figure_exists.py Collecting matplotlib==3.2.1  Using cached https://files.pythonhosted.org/packages/b2/c2/71fcf957710f3ba1f09088b35776a799ba7dd95f7c2b195ec800933b276b/matplotlib-3.2.1-cp37-cp37m-manylinux1_x86_64.whlRequirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (2.4.0)Requirement already satisfied: numpy>=1.11 in /usr/local/lib64/python3.7/site-packages (from matplotlib==3.2.1) (1.18.4)Requirement already satisfied: python-dateutil>=2.1 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (2.8.0)Requirement already satisfied: cycler>=0.10 in /usr/lib/python3.7/site-packages (from matplotlib==3.2.1) (0.10.0)Requirement already satisfied: kiwisolver>=1.0.1 in /usr/lib64/python3.7/site-packages (from matplotlib==3.2.1) (1.1.0)Requirement already satisfied: six>=1.5 in /usr/lib/python3.7/site-packages (from python-dateutil>=2.1->matplotlib==3.2.1) (1.12.0)Requirement already satisfied: setuptools in /usr/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib==3.2.1) (40.8.0)Installing collected packages: matplotlib  Found existing installation: matplotlib 3.3.0    Uninstalling matplotlib-3.3.0:      Successfully uninstalled matplotlib-3.3.0Successfully installed matplotlib-3.2.1Matplotlib version: 3.2.1

Matplotlib version

  • Operating system: Fedora Core 30
  • Matplotlib version: 3.3.0 (installed via pip aspip3 install matplotlib==3.3.0 --user )
  • Matplotlib backend (print(matplotlib.get_backend())):
  • Python version: 3.7.0
  • Jupyter version (if applicable):
  • Other libraries:

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