spatialdata-plot icon indicating copy to clipboard operation
spatialdata-plot copied to clipboard

pl.render_labels can not color cell type annotation

Open liuyang2006 opened this issue 6 months ago • 1 comments

Dear author,

I use below command, but the cell type annotation is not working for colors:

sdata_crop1.pl.render_labels("cell_labels", color="Celltype",
   table_name='table2').pl.show(title="Cell labels",
                                dpi=300,
                                  coordinate_systems="global")

Output figure contains no cell type colors:

Image

Could you please confirm if this function is able to render colors for different cell types?

Thank you!

Best, Yang

liuyang2006 avatar May 07 '25 23:05 liuyang2006

I use render shape also failed with colors:

sdata_crop1.pl.render_shapes("cell_boundaries", color="Celltype",
   table_name='table2').pl.show(title="Cell labels",
                                dpi=300,
                                coordinate_systems="global")

Output figure:

Image

But same data, use cell_circles is ok:

sdata_crop1.pl.render_shapes("cell_circles", color="Celltype",
   table_name='table2').pl.show(title="Cell labels",
                                dpi=300,
                                coordinate_systems="global")

Output figure:

Image

liuyang2006 avatar May 08 '25 00:05 liuyang2006

Hey @liuyang2006, that's probably because your table doesn't annotate the cell_labels object but only the cell_circles object. That's currently the default for Xenium.

You can find a tutorial on how to fix that here: https://github.com/ccb-hms/Spatial-Workshop/blob/main/notebooks/nb2_static_plotting.ipynb

I will take that issue here as an occasion to improve the logging though.

timtreis avatar Nov 17 '25 13:11 timtreis