Open
Description
Weird bug, low-ish priority.
The code "circled" in green in this screenshot seem to have no effect. In fact check this:
While if I commend the red code:
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()