We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f7fac79 commit 9bb23e6Copy full SHA for 9bb23e6
src/spatialdata_plot/pl/utils.py
@@ -560,6 +560,13 @@ def _get_colors_for_categorical_obs(
560
else:
561
palette = ["grey" for _ in range(len_cat)]
562
logging.info("input has more than 103 categories. Uniform " "'grey' color will be used for all categories.")
563
+ else:
564
+ # raise error when user didn't provide the right number of colors in palette
565
+ if isinstance(palette, list) and len(palette) != len(categories):
566
+ raise ValueError(
567
+ f"The number of provided values in the palette ({len(palette)}) doesn't agree with the number of "
568
+ f"categories that should be colored ({categories})."
569
+ )
570
571
# otherwise, single channels turn out grey
572
color_idx = np.linspace(0, 1, len_cat) if len_cat > 1 else [0.7]
0 commit comments