Skip to content

Commit

Permalink
Temporary fix for nan in pl.boundaries
Browse files Browse the repository at this point in the history
  • Loading branch information
marcovarrone committed May 8, 2024
1 parent 4e11f5b commit 852ffef
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions src/cellcharter/pl/_shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,13 +140,11 @@ def boundaries(
ax = plt.gca()
if show_cells:
# TODO: remove after spatialdata-plot issue #256 is fixed
try:
# TODO: spatialdata-plot doesn't support legend_loc=False to make the legend disappear.
sdata.pl.render_shapes(elements="cells", color=component_key).pl.show(ax=ax, legend_loc=None)
except TypeError:
sdata.tables["table"].obs[component_key] = sdata.tables["table"].obs[component_key].cat.add_categories([-1])
sdata.tables["table"].obs[component_key] = sdata.tables["table"].obs[component_key].fillna(-1)
sdata.pl.render_shapes(elements="cells", color=component_key).pl.show(ax=ax, legend_loc=None)
sdata.tables["table"].obs[component_key] = sdata.tables["table"].obs[component_key].cat.add_categories([-1])
sdata.tables["table"].obs[component_key] = sdata.tables["table"].obs[component_key].fillna(-1)

# TODO: spatialdata-plot doesn't support legend_loc=False to make the legend disappear.
sdata.pl.render_shapes(elements="cells", color=component_key).pl.show(ax=ax, legend_loc=None)

sdata.pl.render_shapes(
elements="clusters",
Expand Down

0 comments on commit 852ffef

Please sign in to comment.