Skip to content

Closing figures is done by number #15203

@vnmabus

Description

@vnmabus

Closing figures is done by number

Currently, closing a figure is done using the num attribute in the manager. This can cause problems if there are figures not managed by pyplot, as the number could be the same as a
pyplot-managed figure.

As there are efforts to reduce the dependency on pyplot, such as #14024, this should be changed for those to work well. Alternatively, a way to create a manager which selects an appropiate number could work.

Code for reproduction

import matplotlib.pyplot as plt 

# Figure managed by pyplot 
fig1 = plt.figure() 
 
# Figure not managed by pyplot, but using the same backend 
fig2 = fig = plt.new_figure_manager(1).canvas.figure 

fig1.show() 
fig2.show()

Actual outcome

Closing one figure closes both.

Expected outcome

Closing one figure leaves the other open.

Matplotlib version

  • Operating system: All
  • Matplotlib version: 3.0.3
  • Matplotlib backend (print(matplotlib.get_backend())): Qt5Agg
  • Python version: All

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy