Skip to content

Commit 5390fbb

Browse files
timtreisclaude
andcommitted
Fix CI: .table→["table"], sync points after group filtering
- test_render_labels: use sdata["table"] instead of deprecated .table - _render_points: filter the materialized `points` DataFrame when groups + na_color=None so matplotlib scatter gets matching lengths Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 44ffab6 commit 5390fbb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/spatialdata_plot/pl/render.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -853,8 +853,9 @@ def _render_points(
853853
if not hasattr(color_vector, "reset_index")
854854
else (color_vector[keep].reset_index(drop=True))
855855
)
856-
# re-register filtered points in sdata_filt
857-
points_dd = dask.dataframe.from_pandas(points[keep].reset_index(drop=True), npartitions=1)
856+
# filter the materialized points and re-register in sdata_filt
857+
points = points[keep].reset_index(drop=True)
858+
points_dd = dask.dataframe.from_pandas(points, npartitions=1)
858859
sdata_filt.points[element] = PointsModel.parse(points_dd, coordinates={"x": "x", "y": "y"})
859860
set_transformation(
860861
element=sdata_filt.points[element],

tests/pl/test_render_labels.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ def test_plot_respects_custom_colors_from_uns_with_groups_and_palette(
373373
).pl.show()
374374

375375
def test_plot_can_annotate_labels_with_nan_in_table_obs_categorical(self, sdata_blobs: SpatialData):
376-
sdata_blobs.table.obs["cat_color"] = pd.Categorical(["a", "b", "b", "a", "b"] * 5 + [np.nan])
376+
sdata_blobs["table"].obs["cat_color"] = pd.Categorical(["a", "b", "b", "a", "b"] * 5 + [np.nan])
377377
sdata_blobs.pl.render_labels("blobs_labels", color="cat_color").pl.show()
378378

379379
def test_plot_can_annotate_labels_with_nan_in_table_obs_continuous(self, sdata_blobs: SpatialData):

0 commit comments

Comments
 (0)