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