From 3e9ffb6d1c01c8476f86ca3c55a6ff571d128eab Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sat, 3 Dec 2022 17:13:41 -0500 Subject: [PATCH 1/3] DOC: tweak wording on Figure.show warning closes #22169 Co-authored-by: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> --- lib/matplotlib/figure.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 6c18ba1a643e..7bf36affd9af 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2614,12 +2614,16 @@ def show(self, warn=True): may only be shown briefly or not shown at all if you or your environment are not managing an event loop. - Proper use cases for `.Figure.show` include running this from a - GUI application or an IPython shell. - - If you're running a pure python shell or executing a non-GUI - python script, you should use `matplotlib.pyplot.show` instead, - which takes care of managing the event loop for you. + Proper use cases for `.Figure.show` include running this from a GUI + application (where there is persistently an event loop running) or + from a shell with in input hook configured (IPython will do this). + Some, but not all, GUI toolkits will register an input hook on + import. See :ref:`cp_integration` for more details. + + If you're in a shell without input hook integration or executing a + python script, you should use `matplotlib.pyplot.show` with + ``block=True`` instead, which takes care of starting and running + the event loop for you. Parameters ---------- From e3252a6cfbbb310efc55b37ae65295bcd379f740 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 4 Dec 2022 13:08:54 -0500 Subject: [PATCH 2/3] DOC: fix typo Co-authored-by: Oscar Gustafsson --- lib/matplotlib/figure.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 7bf36affd9af..2e5ba8f05ce7 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2616,7 +2616,7 @@ def show(self, warn=True): Proper use cases for `.Figure.show` include running this from a GUI application (where there is persistently an event loop running) or - from a shell with in input hook configured (IPython will do this). + from a shell with an input hook configured (IPython will do this). Some, but not all, GUI toolkits will register an input hook on import. See :ref:`cp_integration` for more details. From 77074ed9f922a9e41eb5a20f0bfb04bca2ed6b94 Mon Sep 17 00:00:00 2001 From: Thomas A Caswell Date: Sun, 4 Dec 2022 17:12:04 -0500 Subject: [PATCH 3/3] DOC: clarify wording Co-authored-by: Jody Klymak --- lib/matplotlib/figure.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py index 2e5ba8f05ce7..7bb7c542ee77 100644 --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2614,11 +2614,13 @@ def show(self, warn=True): may only be shown briefly or not shown at all if you or your environment are not managing an event loop. - Proper use cases for `.Figure.show` include running this from a GUI + Use cases for `.Figure.show` include running this from a GUI application (where there is persistently an event loop running) or - from a shell with an input hook configured (IPython will do this). - Some, but not all, GUI toolkits will register an input hook on - import. See :ref:`cp_integration` for more details. + from a shell, like IPython, that install an input hook to allow the + interactive shell to accept input while the figure is also being + shown and interactive. Some, but not all, GUI toolkits will + register an input hook on import. See :ref:`cp_integration` for + more details. If you're in a shell without input hook integration or executing a python script, you should use `matplotlib.pyplot.show` with @@ -2630,6 +2632,7 @@ def show(self, warn=True): warn : bool, default: True If ``True`` and we are not running headless (i.e. on Linux with an unset DISPLAY), issue warning when called on a non-GUI backend. + """ if self.canvas.manager is None: raise AttributeError( 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