Skip to content

Commit 1fbd167

Browse files
timtreisclaude
andcommitted
feat: add as_points tutorial
Show the how and why of `as_points` on both render_shapes and render_labels, using a real Xenium breast-cancer section (~168k cells). Covers what it draws (one centroid dot per element), what it ignores (outline_*, shape, contour_px), the matplotlib->datashader backend switch at ~50k centroids, and the measured speed trade-off: a large win for shapes (up to ~16x), roughly neutral for labels (a mask already renders as a fast raster). Segmentation masks are derived from the real cell_boundaries via rasterize(return_regions_as_labels=True), since Xenium rep1 ships outlines as shapes with no native labels element. The 3.4 GB download makes the notebook too heavy for CI, so it is excluded from execute.yaml and its committed outputs are trusted. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9482378 commit 1fbd167

4 files changed

Lines changed: 749 additions & 0 deletions

File tree

.github/workflows/execute.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,9 @@ jobs:
6464
else
6565
nbs=$(find tutorials examples -name "*.ipynb" -not -path "*/.ipynb_checkpoints/*" 2>/dev/null || true)
6666
fi
67+
# Notebooks whose datasets are too large for CI (multi-GB downloads):
68+
# their committed outputs are trusted and never re-executed here.
69+
nbs=$(printf '%s\n' "$nbs" | grep -vxF 'tutorials/as_points.ipynb' || true)
6770
if [ -z "$nbs" ]; then
6871
echo "No notebooks to execute."
6972
else

_static/img/as_points.png

135 KB
Loading

tutorials/as_points.ipynb

Lines changed: 735 additions & 0 deletions
Large diffs are not rendered by default.

tutorials/index.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ selection for images, and the `datashader` backend for large collections
4545
of shapes and points.
4646
:::
4747

48+
:::{grid-item-card} Rendering elements as points
49+
:link: /notebooks/tutorials/as_points
50+
:link-type: doc
51+
:img-top: /notebooks/_static/img/as_points.png
52+
53+
Draw shapes and label masks as one dot per centroid with `as_points=True`
54+
— a fast overview that trades geometry for speed, including the matplotlib
55+
→ datashader switch above ~50k elements.
56+
:::
57+
4858
:::{grid-item-card} Scalebars
4959
:link: /notebooks/tutorials/scalebars
5060
:link-type: doc
@@ -65,5 +75,6 @@ getting_started
6575
color_and_palette
6676
multi_panel_color
6777
performance
78+
as_points
6879
scalebars
6980
```

0 commit comments

Comments
 (0)