Skip to content
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

Cannot combine shapes and images on the same axes in separate calls. #362

Open
LucaMarconato opened this issue Sep 27, 2024 · 0 comments
Open
Labels
bug Something isn't working priority: low

Comments

@LucaMarconato
Copy link
Member

Weird bug, low-ish priority.

The code "circled" in green in this screenshot seem to have no effect. In fact check this:
image

While if I commend the red code:
image

I tried to make a minimal working example for this bug, but I can't reproduce (instead, the code above is from this notebook; it requires to download some data but it should run in 1-2 minutes without errors).

##
from spatialdata.datasets import blobs_annotating_element
import spatialdata_plot
import matplotlib.pyplot as plt

sdata0 = blobs_annotating_element("blobs_polygons")
sdata1 = sdata0.query.bounding_box(
    axes=("x", "y"), min_coordinate=[10, 10], max_coordinate=[30, 30], target_coordinate_system="global"
)

axes = plt.subplots(1, 2)[1]
sdata0.pl.render_images("blobs_image").pl.show(ax=axes[0])
sdata1["blobs_polygons"]["categorical_from_df"] = 1
sdata1["blobs_polygons"]["categorical_from_df"] = sdata1["blobs_polygons"]["categorical_from_df"].astype("category")
sdata1.pl.render_shapes("blobs_polygons", color="categorical_from_df").pl.show(ax=axes[0])


sdata1["table"].obs["categorical_from_table"] = sdata1["table"].obs["instance_id"].astype("category")
sdata0.pl.render_images("blobs_image").pl.show(ax=axes[1])
sdata1.pl.render_shapes("blobs_polygons", color="categorical_from_table").pl.show(ax=axes[1])
plt.tight_layout()
plt.show()

Shows the correct plot:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working priority: low
Projects
None yet
Development

No branches or pull requests

1 participant