Skip to content

Commit afa4056

Browse files
timtreisclaude
andauthored
docs: add a Scalebars tutorial (#12)
* docs: add a Scalebars tutorial A focused tutorial on drawing physical scalebars via the scalebar_* arguments of .pl.show(), on the synthetic blobs dataset: - scalebar_dx (the one required piece) and why it's needed: SpatialData coordinate systems carry no unit metadata, so you supply the physical size of one axes-unit. - scalebar_units and automatic magnitude scaling (um -> mm). - styling via scalebar_params (placement, colour, box, length_fraction, scale_loc, fonts) - forwarded verbatim to matplotlib-scalebar. - fixed_value for an exact bar length. - cross-links the Visium example for a real-data figure. Wired into the gallery: card in tutorials/index.md (inside the gallery-cards markers, root-relative paths) + toctree entry + thumbnail. Addresses part of scverse/spatialdata-plot#463. * docs(scalebars): fix white-on-white bar in the fonts and fixed-length cells Those two cells set color="white" but relied on matplotlib-scalebar's default white box, so the bar landed on the box and vanished. Give them a translucent dark box (box_color/box_alpha), and add a note to the appearance section that white bars on a dark image need a dark box or frameon=False. * docs(scalebars): tighten prose, fix thumbnail, correct asset-path docs - Prose pass on the scalebar tutorial markdown cells. - Regenerate the gallery thumbnail from the notebook's final plot: no title/axes, landscape ~1.11 ratio to match the sibling cards. - CONTRIBUTING: reference assets by the submodule-mount paths (absolute /notebooks/... for index.md cards, relative ../ from notebook cells). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * docs(scalebars): add rotation + label section, sync thumbnail - New §5 demonstrating a vertical bar (`rotation`) and a custom bar title (`label`/`label_loc`); old wrap-up renumbered to §6. - Regenerate the gallery thumbnail from this final plot: vertical 100 µm bar with a "scale" label, landscape ~1.11 to match the sibling cards. - Re-executed end-to-end so committed outputs are current. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 6a6e73c commit afa4056

4 files changed

Lines changed: 476 additions & 4 deletions

File tree

CONTRIBUTING.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,14 @@ pre-commit install
3636
toctree.
3737

3838
6. Place the gallery thumbnail and any other media (GIFs, screenshots, static
39-
PNGs referenced from the notebook) under `_static/img/`. Reference them from
40-
`index.md` and notebook markdown cells with relative paths
41-
(e.g. `:img-top: ../_static/img/<slug>.png` from inside `examples/` or
42-
`tutorials/`, and `![…](../_static/img/<slug>.gif)` from a notebook cell).
39+
PNGs referenced from the notebook) under `_static/img/`. This repo is mounted
40+
as a git submodule at `docs/notebooks/` in the `spatialdata-plot` Sphinx
41+
build, so paths resolve against that mount:
42+
- **Gallery cards in `index.md`** — use the absolute source-root path:
43+
`:img-top: /notebooks/_static/img/<slug>.png`.
44+
- **Notebook markdown cells** — use a path relative to the notebook:
45+
`![…](../_static/img/<slug>.gif)`.
46+
4347
Do **not** drop assets next to the notebook itself.
4448

4549
7. Open a PR. CI will:

_static/img/scalebars.png

208 KB
Loading

tutorials/index.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,15 @@ selection for images, and the `datashader` backend for large collections
3535
of shapes and points.
3636
:::
3737

38+
:::{grid-item-card} Scalebars
39+
:link: /notebooks/tutorials/scalebars
40+
:link-type: doc
41+
:img-top: /notebooks/_static/img/scalebars.png
42+
43+
Add a physical scalebar with `scalebar_dx`, choose units, and style
44+
placement, colour, length and fonts through `scalebar_params`.
45+
:::
46+
3847
::::
3948
<!-- gallery-cards-end -->
4049

@@ -45,4 +54,5 @@ of shapes and points.
4554
getting_started
4655
color_and_palette
4756
performance
57+
scalebars
4858
```

tutorials/scalebars.ipynb

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

0 commit comments

Comments
 (0)