scverse / squidpy

Spatial Single Cell Analysis in Python
https://squidpy.readthedocs.io/en/stable/
BSD 3-Clause "New" or "Revised" License
420 stars 76 forks source link

Error plotting selected clusters on top on image layer #716

Open jnmark opened 1 year ago

jnmark commented 1 year ago

Hello, I have a question about this tutorial: https://squidpy.readthedocs.io/en/latest/notebooks/examples/plotting/plot_segment.html. In this tutorial, you have plotted fibroblast and epithelial clusters at once on two FOVs:

Screenshot 2023-06-21 at 10 22 14 PM

But when these are plotted without the image here, their "locations" seem to have been inverted i.e. "Fibroblasts" (which are green below) are designated in locations where "Epithelial" (in orange) appear above, but the legend indicating color and cell type remains the same. Why is this happening?

Screenshot 2023-06-21 at 10 34 54 PM Screenshot 2023-06-21 at 10 34 59 PM

I am facing the same issue in my dataset - when I plot all leiden clusters vs. plot only 2 selected clusters using the 'group' argument, their locations don't agree. I came to the tutorial looking for an answer, and was surprised to see the same behavior, any help will be appreciated. Thanks!

giovp commented 11 months ago

hi @jnmark this is a known issue unfortunately, I would suggest you to take a look at https://github.com/scverse/spatialdata-plot where there is a function that should be able to handle that situation