8000 FIX: ensure switching the backend while interactive is interactive · matplotlib/matplotlib@20db32a · GitHub
[go: up one dir, main page]

Skip to content

Commit 20db32a

Browse files
committed
FIX: ensure switching the backend while interactive is interactive
closes #23042 In #22005 we change `pyplot` so that at import time we do not force a switch of the backend and install the repl displayhook. However, this meant that in some cases (primarily through `ipython --pylab`) to end up with a session where `install_repl_displayhook` had never been called.
1 parent f25c2d0 commit 20db32a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/matplotlib/pyplot.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,10 @@ class backend_mod(matplotlib.backend_bases._Backend):
302302
# See https://github.com/matplotlib/matplotlib/issues/6092
303303
matplotlib.backends.backend = newbackend
304304

305+
# make sure the repl display hook is installed if we are interactive
306+
if isinteractive():
307+
install_repl_displayhook()
308+
305309

306310
def _warn_if_gui_out_of_main_thread():
307311
if (_get_required_interactive_framework(_get_backend_mod())

0 commit comments

Comments
 (0)
0