Skip to content

Commit 618ecc9

Browse files
committed
Clarify docstring of [un]install_repl_displayhook()
Still not clear to me: Does this have to be a public function? When would a user call it explicitly?
1 parent 925b27f commit 618ecc9

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

lib/matplotlib/pyplot.py

+6-11
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ def _copy_docstring_and_deprecators(method, func=None):
114114

115115
def install_repl_displayhook():
116116
"""
117-
Install a repl display hook so that any stale figure are automatically
118-
redrawn when control is returned to the repl.
117+
Connect to the display hook of the current shell.
118+
119+
The display hook gets called when the read-evaluate-print-loop (REPL) of
120+
the shell has finished the execution of a command. We use this callback
121+
to be able to automatically update a figure in interactive mode.
119122
120123
This works both with IPython and with vanilla python shells.
121124
"""
@@ -152,15 +155,7 @@ def post_execute():
152155

153156

154157
def uninstall_repl_displayhook():
155-
"""
156-
Uninstall the Matplotlib display hook.
157-
158-
.. warning::
159-
160-
If you are using vanilla python and have installed another display hook,
161-
this will reset `sys.displayhook` to what ever function was there when
162-
Matplotlib installed its displayhook, possibly discarding your changes.
163-
"""
158+
"""Disconnect from the display hook of the current shell."""
164159
global _IP_REGISTERED
165160
global _INSTALL_FIG_OBSERVER
166161
if _IP_REGISTERED:

0 commit comments

Comments
 (0)