diff --git a/lib/matplotlib/backends/backend_nbagg.py b/lib/matplotlib/backends/backend_nbagg.py index 19d3ea589553..8bdf4b626d35 100644 --- a/lib/matplotlib/backends/backend_nbagg.py +++ b/lib/matplotlib/backends/backend_nbagg.py @@ -39,7 +39,7 @@ def connection_info(): for manager in Gcf.get_all_fig_managers() ] if not is_interactive(): - result.append('Figures pending show: {}'.format(len(Gcf._activeQue))) + result.append(f'Figures pending show: {len(Gcf.figs)}') return '\n'.join(result) @@ -259,12 +259,12 @@ def show(*args, block=None, **kwargs): for manager in managers: manager.show() - # plt.figure adds an event which puts the figure in focus - # in the activeQue. Disable this behaviour, as it results in + # plt.figure adds an event which makes the figure in focus the + # active one. Disable this behaviour, as it results in # figures being put as the active figure after they have been # shown, even in non-interactive mode. if hasattr(manager, '_cidgcf'): manager.canvas.mpl_disconnect(manager._cidgcf) - if not interactive and manager in Gcf._activeQue: - Gcf._activeQue.remove(manager) + if not interactive: + Gcf.figs.pop(manager.num, None)