docs: add as_points tutorial - #15
Open
timtreis wants to merge 6 commits into
Open
Conversation
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>
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
📖 Docs preview: https://scverse.org/spatialdata-plot-tutorials/pr-15/gallery.html Built from 684af4d; redeployed on every push. |
Show as_points on render_shapes and render_labels using a real Xenium breast-cancer section (167780 cells). Covers what it draws (one centroid dot per element), the appearance controls that still apply (color, size, cmap, palette), what it ignores (outline_*, shape, contour_px), the matplotlib and datashader backends with the 50000-centroid switch, and the measured speed trade-off: a large win for shapes (up to 16x), about 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>
Open the speed section with the entire 167780-cell section rendered as full geometry and as as_points, coloured by EPCAM. Previously the full dataset only appeared as as_points in the backend section; the full-geometry vs as_points comparison was limited to the crop. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The default backend already draws the 167780-cell as_points panel with datashader, so the backend section's datashader render repeated the full-section image. Drop that render and explain the backend in prose, referencing the panel above. In the shared-scale two-panel crops, draw the colourbar only on the right panel so it no longer overlaps the neighbouring axes. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
At the default marker size the datashader spread left white gaps, so the whole-section panel looked grainy. Draw it with datashader and size=12 so each cell spreads into continuous coverage, matching the overview look, and note in the prose that size controls the spread on that backend. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Revert the whole-slide full-geometry vs as_points panel and its follow-on tweaks; the notebook reads better without it. This restores the matplotlib vs datashader backend comparison that had been removed. The only change kept from that stretch is drawing a single colourbar per shared-scale panel pair, so they no longer overlap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
tutorials/as_points.ipynb, covering how and why to useas_pointsonrender_shapesandrender_labels.What it covers
as_points=Truedraws one centroid dot per element instead of the full geometry;outline_*,shapeandcontour_pxare ignored.color(gene name, column, or literal),size,cmap,palette. The visuals colour by EPCAM to show a real spatial trend.cell_boundariesviarasterize(return_regions_as_labels=True), since Xenium rep1 ships outlines as shapes with no native labels element.AS_POINTS_DS_AUTO = 50000matplotlib-to-datashader switch, plus the datashader fallback for the random-colour-per-cell case.as_pointsthere is about representation, not speed).CI
The dataset is a 3.4 GB download, too heavy for
execute.yaml. The notebook is added to the exclude filter and its committed outputs are trusted (executed locally, zero errors). Lint still runs and passes.Wiring
Gallery card and toctree entry in
tutorials/index.md; thumbnail at_static/img/as_points.pngshowing real cell boundaries turning into centroid points.