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

Skip to content

Commit e779b97

Browse files
authored
Merge pull request #22911 from timhoffm/doc-repl-displayhook
DOC: Clarify docstring of [un]install_repl_displayhook()
2 parents 6e52c24 + 83701e9 commit e779b97

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/matplotlib/pyplot.py

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,11 @@ def _draw_all_if_interactive():
122122

123123
def install_repl_displayhook():
124124
"""
125-
Install a repl display hook so that any stale figure are automatically
126-
redrawn when control is returned to the repl.
125+
Connect to the display hook of the current shell.
126+
127+
The display hook gets called when the read-evaluate-print-loop (REPL) of
128+
the shell has finished the execution of a command. We use this callback
129+
to be able to automatically update a figure in interactive mode.
127130
128131
This works both with IPython and with vanilla python shells.
129132
"""
@@ -155,15 +158,7 @@ def install_repl_displayhook():
155158

156159

157160
def uninstall_repl_displayhook():
158-
"""
159-
Uninstall the Matplotlib display hook.
160-
161-
.. warning::
162-
163-
If you are using vanilla python and have installed another display hook,
164-
this will reset `sys.displayhook` to what ever function was there when
165-
Matplotlib installed its displayhook, possibly discarding your changes.
166-
"""
161+
"""Disconnect from the display hook of the current shell."""
167162
global _REPL_DISPLAYHOOK
168163
if _REPL_DISPLAYHOOK is _ReplDisplayHook.IPYTHON:
169164
from IPython import get_ipython

0 commit comments

Comments
 (0)