From 49a3bedb2085cb80e94f9b2aefca84b8ee62bf96 Mon Sep 17 00:00:00 2001 From: erdogant Date: Wed, 23 Mar 2022 08:49:56 +0100 Subject: [PATCH] 1.1.1 --- scatterd/__init__.py | 2 +- scatterd/scatterd.py | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/scatterd/__init__.py b/scatterd/__init__.py index 85c9527..bde31b6 100644 --- a/scatterd/__init__.py +++ b/scatterd/__init__.py @@ -2,7 +2,7 @@ __author__ = 'Erdogan Tasksen' __email__ = 'erdogant@gmail.com' -__version__ = '1.1.0' +__version__ = '1.1.1' # module level doc-string __doc__ = """ diff --git a/scatterd/scatterd.py b/scatterd/scatterd.py index 2b82c0a..080b3fd 100644 --- a/scatterd/scatterd.py +++ b/scatterd/scatterd.py @@ -199,6 +199,10 @@ def set_colors(X, labels, fontcolor, c, cmap, gradient=None): c_rgb, _ = colourmap.fromlist(labels, cmap=cmap, method='matplotlib', gradient=gradient) elif len(c)==3 and (isinstance(c[0], int) or isinstance(c[0], float)): c_rgb = np.repeat([c], X.shape[0], axis=0).reshape(-1, 3) + elif len(c)==1 and isinstance(c, list): + c_rgb = np.repeat(c[0], X.shape[0], axis=0).reshape(-1, 3) + else: + c_rgb = np.repeat([0, 0, 0], X.shape[0], axis=0).reshape(-1, 3) if (gradient is not None): c_rgb = gradient_on_density_color(X, c_rgb, labels)