How to plot annotation in Xenium data using spatialdata

sdata.pl.render_shapes('cell_boundaries', color='leiden', cmap='Set3').pl.show()

there is no annotation be plotted.

Hey @christophechu,

it’s very hard to troubleshoot your problem with this little information. It’d be great if you could open a reproducible example as an issue on GitHub - scverse/spatialdata-plot: Static plotting for spatialdata

Thanks!

I find the error, I forgot changing the region from cell_circles to cell_boundaries.

Great to hear that you found a solution @christophechu. We will improve the error message on our side by throwing a clearer error when a color cannot be found (like in your case, because the table was not annotating the elements you were plotting). Tracked here: Fail if color or table do not exist · Issue #409 · scverse/spatialdata-plot · GitHub.

1 Like

another question, how can I get the xy coordinates of my cell_boundaries? I want to use xy and cell annotation to build KNN

Please use spatialdata.get_centroids() for the centers, otherwise you can use the geopandas APIs to extract for each shape it’s coordinates (this will lead to variable length list of pairs for each polygon.

Another approach is to approximates the polygons to circles, with spatialdata.to_circles().

1 Like

Thank you very much.
Spatialdata is an impressive package for high-resolution spatial technology. But the tutorial is a bit hard to follow.