diff --git a/spyder_kernels/console/kernel.py b/spyder_kernels/console/kernel.py index 2d3d5eaa..15a407aa 100644 --- a/spyder_kernels/console/kernel.py +++ b/spyder_kernels/console/kernel.py @@ -498,7 +498,7 @@ def get_matplotlib_backend(self): """Get current matplotlib backend.""" try: import matplotlib - return MPL_BACKENDS_TO_SPYDER[matplotlib.get_backend()] + return MPL_BACKENDS_TO_SPYDER[matplotlib.get_backend().lower()] except Exception: return None diff --git a/spyder_kernels/utils/mpl.py b/spyder_kernels/utils/mpl.py index 00f47bac..8ac557f7 100644 --- a/spyder_kernels/utils/mpl.py +++ b/spyder_kernels/utils/mpl.py @@ -20,11 +20,12 @@ # Mapping of matlotlib backends options to Spyder MPL_BACKENDS_TO_SPYDER = { - inline_backend: "inline", - 'Qt5Agg': 'qt', - 'QtAgg': 'qt', # For Matplotlib 3.5+ - 'TkAgg': 'tk', - 'MacOSX': 'osx', + 'inline': 'inline', # For Matplotlib >=3.9 + inline_backend: "inline", # For Matplotlib <3.9 + 'qt5agg': 'qt', + 'qtagg': 'qt', # For Matplotlib 3.5+ + 'tkagg': 'tk', + 'macosx': 'osx', }