Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork8.1k
Closed
Milestone
Description
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) == FalseAssertionErrorExpected 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.1Matplotlib version
- Operating system: Fedora Core 30
- Matplotlib version: 3.3.0 (installed via pip as
pip3 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
Labels
No labels