Compare plt.get_backend() in lowercase (#8409)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
Mactarvish 2024-02-24 03:04:41 +08:00 committed by GitHub
parent d6edf1c1d8
commit 60b6cab6cf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -212,7 +212,7 @@ def plt_settings(rcparams=None, backend="Agg"):
def wrapper(*args, **kwargs):
"""Sets rc parameters and backend, calls the original function, and restores the settings."""
original_backend = plt.get_backend()
if backend != original_backend:
if backend.lower() != original_backend.lower():
plt.close("all") # auto-close()ing of figures upon backend switching is deprecated since 3.8
plt.switch_backend(backend)