Skip to content

Commit 1bd4b78

Browse files
authored
No longer failing when xyz is in adata.uns but not xyz_colors (#339)
1 parent a360aa3 commit 1bd4b78

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/spatialdata_plot/pl/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -871,7 +871,7 @@ def _generate_base_categorial_color_mapping(
871871
color_source_vector: ArrayLike | pd.Series[CategoricalDtype],
872872
na_color: ColorLike,
873873
) -> Mapping[str, str]:
874-
if adata is not None and cluster_key in adata.uns:
874+
if adata is not None and cluster_key in adata.uns and f"{cluster_key}_colors" in adata.uns:
875875
colors = adata.uns[f"{cluster_key}_colors"]
876876
categories = color_source_vector.categories.tolist() + ["NaN"]
877877
if "#" not in na_color:

0 commit comments

Comments
 (0)