diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py index fba7f1a7b323..8ae8bba82593 100644 --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -227,7 +227,8 @@ def switch_backend(newbackend): The name of the backend to use. """ global _backend_mod - + # make sure the init is pulled up so we can assign to it later + import matplotlib.backends close("all") if newbackend is rcsetup._auto_backend_sentinel: