From d4e4dcbb9ea26e337581fda99f1fb17d18353e77 Mon Sep 17 00:00:00 2001 From: thorstenwagner Date: Mon, 17 Jun 2024 15:42:40 +0200 Subject: [PATCH] fix matplotlib 3.9 issue (issue #74) --- src/box_manager/io/tloc.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/box_manager/io/tloc.py b/src/box_manager/io/tloc.py index ac4c619..9d81c97 100644 --- a/src/box_manager/io/tloc.py +++ b/src/box_manager/io/tloc.py @@ -2,6 +2,7 @@ import os import typing +import matplotlib import matplotlib.cm as mcm import numpy as np import numpy.typing as npt @@ -109,8 +110,12 @@ def to_napari( napari_type, ) ) + try: + colors = mcm.get_cmap("gist_rainbow") + except AttributeError: + # for matplotlib > 3.9 + colors = matplotlib.colormaps["gist_rainbow"] - colors = mcm.get_cmap("gist_rainbow") n_layers = np.maximum(len(output_dfs), 2) # Avoid zero division for cidx, (data, kwargs, _) in enumerate(output_dfs):