Skip to content

Commit 5339d39

Browse files
authored
implement label fix (#280)
1 parent 227b992 commit 5339d39

1 file changed

Lines changed: 26 additions & 25 deletions

File tree

src/spatialdata_plot/pl/basic.py

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -897,31 +897,32 @@ def show(
897897
sdata, wanted_elements, params_copy, cs, "labels"
898898
)
899899

900-
if wanted_labels_on_this_cs and (table := params_copy.table_name) is not None:
901-
colors = sc.get.obs_df(sdata[table], params_copy.color)
902-
if isinstance(colors.dtype, pd.CategoricalDtype):
903-
_maybe_set_colors(
904-
source=sdata[table],
905-
target=sdata[table],
906-
key=params_copy.color,
907-
palette=params_copy.palette,
908-
)
909-
910-
rasterize = (params_copy.scale is None) or (
911-
isinstance(params_copy.scale, str)
912-
and params_copy.scale != "full"
913-
and (dpi is not None or figsize is not None)
914-
)
915-
_render_labels(
916-
sdata=sdata,
917-
render_params=params_copy,
918-
coordinate_system=cs,
919-
ax=ax,
920-
fig_params=fig_params,
921-
scalebar_params=scalebar_params,
922-
legend_params=legend_params,
923-
rasterize=rasterize,
924-
)
900+
if wanted_labels_on_this_cs:
901+
if (table := params_copy.table_name) is not None:
902+
colors = sc.get.obs_df(sdata[table], params_copy.color)
903+
if isinstance(colors.dtype, pd.CategoricalDtype):
904+
_maybe_set_colors(
905+
source=sdata[table],
906+
target=sdata[table],
907+
key=params_copy.color,
908+
palette=params_copy.palette,
909+
)
910+
911+
rasterize = (params_copy.scale is None) or (
912+
isinstance(params_copy.scale, str)
913+
and params_copy.scale != "full"
914+
and (dpi is not None or figsize is not None)
915+
)
916+
_render_labels(
917+
sdata=sdata,
918+
render_params=params_copy,
919+
coordinate_system=cs,
920+
ax=ax,
921+
fig_params=fig_params,
922+
scalebar_params=scalebar_params,
923+
legend_params=legend_params,
924+
rasterize=rasterize,
925+
)
925926

926927
if title is None:
927928
t = cs

0 commit comments

Comments
 (0)