Skip to content

Commit 271d4bd

Browse files
fix plot categorical with colors, on labels (#337)
1 parent 4666968 commit 271d4bd

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/napari_spatialdata/_widgets.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ def _(self, vec: pd.Series, **kwargs: Any) -> dict[str, Any]:
218218
color_dict = dict(zip(vec.cat.categories, colors, strict=False))
219219
color_dict.update({np.nan: "#808080ff"})
220220
else:
221-
color_dict = self.model.adata.uns[vec_color_name]
221+
colors = self.model.adata.uns[vec_color_name]
222+
color_dict = dict(zip(vec.cat.categories, colors.tolist(), strict=True))
222223
else:
223224
df = layer.metadata["_columns_df"]
224225
if vec_color_name not in df.columns:

0 commit comments

Comments
 (0)