Skip to content

Commit 2edc11c

Browse files
committed
fix
1 parent 5d419f7 commit 2edc11c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/spatialdata_plot/pl/basic.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -951,8 +951,9 @@ def show(
951951
if wanted_labels_on_this_cs:
952952
if (table := params_copy.table_name) is not None:
953953
keys = [params_copy.color] if not isinstance(params_copy.color, list) else params_copy.color
954+
assert len(keys) == 1
954955
colors = sc.get.obs_df(sdata[table], keys)
955-
if isinstance(colors.dtype, pd.CategoricalDtype):
956+
if isinstance(colors[keys[0]].dtype, pd.CategoricalDtype):
956957
_maybe_set_colors(
957958
source=sdata[table],
958959
target=sdata[table],

src/spatialdata_plot/pl/render.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,9 +454,10 @@ def _render_points(
454454

455455
if col_for_color is not None:
456456
keys = [col_for_color] if not isinstance(col_for_color, list) else col_for_color
457+
assert len(keys) == 1
457458
cols = sc.get.obs_df(adata, keys)
458459
# maybe set color based on type
459-
if isinstance(cols.dtype, pd.CategoricalDtype):
460+
if isinstance(cols[keys[0]].dtype, pd.CategoricalDtype):
460461
_maybe_set_colors(
461462
source=adata,
462463
target=adata,

0 commit comments

Comments
 (0)