Hi there, I am wanting to create a similar plot to the one below with my Xenium sample. There are cell type labels in the Anndata.obs, but I can only plot them on the cell_circles and not the cell_labels. I also want to be able to plot transcripts for specific genes, but it seems like I can only plot all or none of the transcripts.
The plot below was done by someone else using Napari, but not from spatialdata, and has cells coloured by a metadata column and is plotting the transcripts for just one gene. Is there a way to do this napari_spatialdata? Thanks.
Hi @lhock17, plotting the table annotation on the labels instead of the circles can be done both in napari-spatialdata and spatialdata-plot by setting a new target for the table. This is shown in this new tutorial here: Technology focus: Xenium — spatialdata.
Plotting only a particular cell-type is currently only possible for spaitaldata-plot (please see the last plot in the notebook above). We want to eventually enable the functionality also in napari-spatialdata.
The code works for cosmx
crop0(cosmx_sdata).pl.render_labels(outline_alpha=0.4, fill_alpha=0.1,
color=“cell_type”, contour_px= None,
palette=colors, groups=groups).pl.show(coordinate_systems=“13”,figsize=(8,6))
but not for Xenium
crop0(xenium_sdata).pl.render_shapes(“cell_circles”, color=“cell_type”,table_name=‘table’).pl.show(coordinate_systems=[“global”],figsize=(20,12.5))
This is using spatialdata-plot. I think the issue is not fixed yet.
For Xenium, be it shapes/labels nothing works
Thank you @OnkarMessi for reaching out. The default target for the annotation table for Xenium changed from the cell_circles
to the cell_labels
. This example from the API docs shows how to change the target spatialdata-io/src/spatialdata_io/readers/xenium.py at e9b74c0a1ada826c1b3fc579401d776c887c8923 · scverse/spatialdata-io · GitHub.
This should address your issue.
This is using spatialdata-plot. I think the issue is not fixed yet.
For Xenium, be it shapes/labels nothing works
I believe it works, since the plot is reproduced in the documentation notebook: Technology focus: Xenium — spatialdata.
But in case in which the problem persist I kindly ask you to share a fully reproducible code snippet so I can investigate this further.