-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problem with indices vs positional indices in shapes #169
Comments
I'm running into the same issue |
Hi @timtreis I just noticed that this bug is still open. Do you have any timeline for a fix? Thanks 😊 |
Here is how to reproduce the problem. When the table has less rows than the shapes, the problem appears. import matplotlib.pyplot as plt
from spatialdata.datasets import blobs_annotating_element
import spatialdata_plot
sdata = blobs_annotating_element("blobs_circles")
sdata['table'] = sdata['table'][:3]
sdata.pl.render_shapes("blobs_circles", color="instance_id").pl.show()
plt.show() The behavior in In napari shapes that are not present in the table are plotted in gray, while rows that are present in the table but not in the shapes are simply ignored. The order is matched via the |
The bug is related to this #178 which if I remember well Sonja had fixed (and tests were added), I am looking for her PR. I think that plot can be made with any order so maybe the only uncovered cases are when there is a different number of rows between shapes and table. Using |
Here are the PRs from Sonja https://github.com/scverse/spatialdata-plot/pull/163/files and https://github.com/scverse/spatialdata-plot/pull/177/files. So it seems that:
Practically, to address the issue I suggest to proceed as follows:
|
Related bug, reported in #357. Using groups leads to a filtering of the table and triggers this bug due to a table/shapes mismatch (that is expected). |
I have just noticed that the squidpy notebook can't make the last plot; it should be a quick fix. The latest version of the notebook (gonna be merge in main soon) is this one: https://github.com/scverse/spatialdata-notebooks/blob/fix/remove_napari/notebooks/examples/squidpy_integration.ipynb
The dataset used in the notebook is the xenium rep 1 data, it should be unchanged from the one we have downloaded and the S3 version should be up-to-date (I will re-enable the upload functions today/tomorrow, so for sure it will be up-to-date soon).
The problem seem to be due to the use of positional indices where ".loc" indices should have been used. Please see the screenshot: the
cell_id
andgdf.index
columns match, but it seems that at some point either a positional index for the table, either thetable.obs.index
has been used.Faulty line:
Traceback
The text was updated successfully, but these errors were encountered: