|
10 | 10 | "By default, `spatialdata-plot` draws each element as its full geometry: a shape\n", |
11 | 11 | "as its polygon or circle, a labels element as its filled segmentation mask.\n", |
12 | 12 | "Passing `as_points=True` to `render_shapes()` or `render_labels()` draws one dot\n", |
13 | | - "per element at its centroid instead. You keep where each object sits and what\n", |
| 13 | + "per element at its centroid (its geometric centre) instead. You keep where each object sits and what\n", |
14 | 14 | "colour it has, and you give up its size and outline.\n", |
15 | 15 | "\n", |
16 | 16 | "This notebook covers:\n", |
|
41 | 41 | "the SpatialData Zarr format and hosted on the scverse example-data bucket. It is\n", |
42 | 42 | "about 3.4 GB. `pooch` downloads it once and caches it, so later runs are instant.\n", |
43 | 43 | "\n", |
44 | | - "This notebook is not re-executed in CI, because the download is too large. Its\n", |
45 | | - "outputs are committed and trusted; run it locally to reproduce them." |
| 44 | + "**This notebook is not re-executed in CI, because the download is too large. Its\n", |
| 45 | + "outputs are committed and trusted; run it locally to reproduce them.**" |
46 | 46 | ] |
47 | 47 | }, |
48 | 48 | { |
|
222 | 222 | "\n", |
223 | 223 | "Here we colour by `EPCAM`, an epithelial marker. Its expression follows the\n", |
224 | 224 | "tissue: the ductal and tumour regions are bright, the surrounding stroma is dark.\n", |
225 | | - "The centroid view keeps that spatial trend after dropping the outlines." |
| 225 | + "The centroid view keeps that spatial trend after dropping the outlines.\n", |
| 226 | + "\n", |
| 227 | + "The two panels below share a single colourbar only because they plot the same\n", |
| 228 | + "`EPCAM` values. To guarantee a shared scale across panels that differ, pass an\n", |
| 229 | + "explicit `norm` (e.g. `matplotlib.colors.Normalize(vmin, vmax)`) to each render call." |
226 | 230 | ] |
227 | 231 | }, |
228 | 232 | { |
|
269 | 273 | "`size` sets the marker area (matplotlib's scatter `s`), independent of the data.\n", |
270 | 274 | "It is a styling choice, not the cell's real size, which the centroid view does\n", |
271 | 275 | "not carry. Larger markers read better when zoomed out; smaller ones keep dense\n", |
272 | | - "regions from overlapping into a blob." |
| 276 | + "regions from overlapping into a blob.\n", |
| 277 | + "\n", |
| 278 | + "The default is `size=1.0`, deliberately tiny so that dense point sets do not merge\n", |
| 279 | + "into a blob; you will usually raise it, as every example here does." |
273 | 280 | ] |
274 | 281 | }, |
275 | 282 | { |
|
634 | 641 | "id": "18008bc2", |
635 | 642 | "metadata": {}, |
636 | 643 | "source": [ |
637 | | - "The dots can be drawn by either backend, set with `method`:\n", |
| 644 | + "**datashader** is a library that renders very large point sets by aggregating them\n", |
| 645 | + "into a pixel grid instead of drawing each dot individually; `spatialdata-plot` uses\n", |
| 646 | + "it as an optional backend. The dots can be drawn by either backend, set with `method`:\n", |
638 | 647 | "\n", |
639 | 648 | "- `method=\"matplotlib\"`: per-glyph scatter, exact, good up to tens of thousands\n", |
640 | 649 | " of dots.\n", |
|
646 | 655 | "datashader aggregates and then shades, so it cannot represent one distinct random\n", |
647 | 656 | "colour per cell, which is the default colouring of a labels element with no\n", |
648 | 657 | "colour column. In that case it falls back to matplotlib with a warning. With a\n", |
649 | | - "real colour column, as below, both backends work and differ only in appearance." |
| 658 | + "real colour column, as below, both backends work and differ only in appearance.\n", |
| 659 | + "\n", |
| 660 | + "As in section 2, the single colourbar below is valid only because both panels map the\n", |
| 661 | + "same values; pass an explicit `norm` to guarantee a shared scale otherwise." |
650 | 662 | ] |
651 | 663 | }, |
652 | 664 | { |
|
0 commit comments