diff --git a/lib/matplotlib/backends/registry.py b/lib/matplotlib/backends/registry.py index 628e49cbf50f..19b4cba254ab 100644 --- a/lib/matplotlib/backends/registry.py +++ b/lib/matplotlib/backends/registry.py @@ -397,7 +397,7 @@ def resolve_gui_or_backend(self, gui_or_backend): # First check if it is a gui loop name. backend = self.backend_for_gui_framework(gui_or_backend) if backend is not None: - return backend, gui_or_backend + return backend, gui_or_backend if gui_or_backend != "headless" else None # Then check if it is a backend name. try: