From e2d45d56ca84372158938caf3a6bc3cb982583e5 Mon Sep 17 00:00:00 2001 From: Antony Lee Date: Sun, 13 Aug 2023 19:26:18 +0200 Subject: [PATCH] Replace reference to %pylab by %matplotlib. ... as %pylab is deprecated, and %matplotlib is really the relevant mode here. --- lib/matplotlib/backend_bases.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/backend_bases.py b/lib/matplotlib/backend_bases.py index 840082cc91ea..009410593b34 100644 --- a/lib/matplotlib/backend_bases.py +++ b/lib/matplotlib/backend_bases.py @@ -3412,9 +3412,9 @@ def show(cls, *, block=None): """ Show all figures. - `show` blocks by calling `mainloop` if *block* is ``True``, or if it - is ``None`` and we are neither in IPython's ``%pylab`` mode, nor in - `interactive` mode. + `show` blocks by calling `mainloop` if *block* is ``True``, or if it is + ``None`` and we are not in `interactive` mode and if IPython's + ``%matplotlib`` integration has not been activated. """ managers = Gcf.get_all_fig_managers() if not managers: @@ -3427,9 +3427,9 @@ def show(cls, *, block=None): if cls.mainloop is None: return if block is None: - # Hack: Are we in IPython's %pylab mode? In pylab mode, IPython - # (>= 0.10) tacks a _needmain attribute onto pyplot.show (always - # set to False). + # Hack: Is IPython's %matplotlib integration activated? If so, + # IPython's activate_matplotlib (>= 0.10) tacks a _needmain + # attribute onto pyplot.show (always set to False). pyplot_show = getattr(sys.modules.get("matplotlib.pyplot"), "show", None) ipython_pylab = hasattr(pyplot_show, "_needmain") block = not ipython_pylab and not is_interactive()