From f7fa9b355c2691eaf2808a785d03a099e51e2288 Mon Sep 17 00:00:00 2001 From: Peter O'Connor Date: Tue, 11 Mar 2025 09:21:11 -0600 Subject: [PATCH] Update pyplot_plus.py --- artemis/plotting/pyplot_plus.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/artemis/plotting/pyplot_plus.py b/artemis/plotting/pyplot_plus.py index 8864dce9..af8c0a94 100644 --- a/artemis/plotting/pyplot_plus.py +++ b/artemis/plotting/pyplot_plus.py @@ -3,7 +3,16 @@ import logging import numpy as np import matplotlib.colors as colors -from matplotlib.cm import register_cmap +try: + from matplotlib.cm import register_cmap +except ImportError: + try: + from matplotlib.colors import register_cmap + except ImportError: + # For newer matplotlib versions (>=3.5.0) + from matplotlib import colormaps + def register_cmap(name, cmap): + colormaps.register(cmap=cmap, name=name) from matplotlib.colors import LinearSegmentedColormap from si_prefix import si_format import matplotlib