Skip to content

Commit dbccd04

Browse files
timhoffmmeeseeksmachine
authored andcommitted
Backport PR #24607: DOC: tweak wording on Figure.show warning
1 parent bfa62c4 commit dbccd04

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
@@ -2619,18 +2619,25 @@ def show(self, warn=True):
26192619
may only be shown briefly or not shown at all if you or your
26202620
environment are not managing an event loop.
26212621
2622-
Proper use cases for `.Figure.show` include running this from a
2623-
GUI application or an IPython shell.
2624-
2625-
If you're running a pure python shell or executing a non-GUI
2626-
python script, you should use `matplotlib.pyplot.show` instead,
2627-
which takes care of managing the event loop for you.
2622+
Use cases for `.Figure.show` include running this from a GUI
2623+
application (where there is persistently an event loop running) or
2624+
from a shell, like IPython, that install an input hook to allow the
2625+
interactive shell to accept input while the figure is also being
2626+
shown and interactive. Some, but not all, GUI toolkits will
2627+
register an input hook on import. See :ref:`cp_integration` for
2628+
more details.
2629+
2630+
If you're in a shell without input hook integration or executing a
2631+
python script, you should use `matplotlib.pyplot.show` with
2632+
``block=True`` instead, which takes care of starting and running
2633+
the event loop for you.
26282634
26292635
Parameters
26302636
----------
26312637
warn : bool, default: True
26322638
If ``True`` and we are not running headless (i.e. on Linux with an
26332639
unset DISPLAY), issue warning when called on a non-GUI backend.
2640+
26342641
"""
26352642
if self.canvas.manager is None:
26362643
raise AttributeError(

0 commit comments

Comments
 (0)