You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Safely import pyplot if a GUI framework is already running.
`configure_subplots` now needs to import `pyplot` (because that's
how we can spin up a new figure as needed), but when relying on
embedding we could well reach that point with an already running
interactive framework, pyplot never imported, and an incompatible
rcParams["backend"] (which had not been read yet). For example, run
`examples/user_interfaces/embedding_in_tk_sgskip.py` with a non-tk
backend set in your matplotlibrc: clicking on the the configure_subplots
button triggers a "cannot load backend 'foo' which requires the 'foo'
interactive framework, as 'bar' is currently running".
Instead, use a helper to safely import pyplot when another interactive
framework may already be running. The list of frameworks that
`_get_running_interactive_framework` returns is fixed, so we can just
hardcode the mapping. (We are going to ignore the user-set
`rcParams["backend"]` anyways.)
0 commit comments