Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 666c7e3

Browse files
authored
Merge pull request #24607 from tacaswell/doc/figshow
DOC: tweak wording on Figure.show warning
2 parents e0d65b6 + 77074ed commit 666c7e3

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/matplotlib/figure.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,18 +2614,25 @@ def show(self, warn=True):
26142614
may only be shown briefly or not shown at all if you or your
26152615
environment are not managing an event loop.
26162616
2617-
Proper use cases for `.Figure.show` include running this from a
2618-
GUI application or an IPython shell.
2619-
2620-
If you're running a pure python shell or executing a non-GUI
2621-
python script, you should use `matplotlib.pyplot.show` instead,
2622-
which takes care of managing the event loop for you.
2617+
Use cases for `.Figure.show` include running this from a GUI
2618+
application (where there is persistently an event loop running) or
2619+
from a shell, like IPython, that install an input hook to allow the
2620+
interactive shell to accept input while the figure is also being
2621+
shown and interactive. Some, but not all, GUI toolkits will
2622+
register an input hook on import. See :ref:`cp_integration` for
2623+
more details.
2624+
2625+
If you're in a shell without input hook integration or executing a
2626+
python script, you should use `matplotlib.pyplot.show` with
2627+
``block=True`` instead, which takes care of starting and running
2628+
the event loop for you.
26232629
26242630
Parameters
26252631
----------
26262632
warn : bool, default: True
26272633
If ``True`` and we are not running headless (i.e. on Linux with an
26282634
unset DISPLAY), issue warning when called on a non-GUI backend.
2635+
26292636
"""
26302637
if self.canvas.manager is None:
26312638
raise AttributeError(

0 commit comments

Comments
 (0)