From 2692cf8a3ce42e340d468fbdfb1cd435177bb0a5 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Tue, 10 Dec 2019 14:45:35 +0100 Subject: [PATCH] Update backend_nbagg for removal of Gcf._activeQue. Looks like nbagg was (ab)using _activeQue to have "pyplot-managed figures that can never be gcf()" (not really sure why? this was here ever since nbagg was first merged in). Now that _activeQue has been merged into figs this is no longer possible, but I *guess* the patch is the closest in semantics? --- lib/matplotlib/backends/backend_nbagg.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)