Skip to content

Commit 44c794a

Browse files
timtreisclaude
andcommitted
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>
1 parent a94f5de commit 44c794a

3 files changed

Lines changed: 41 additions & 13 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

36.6 KB
Loading

tutorials/scalebars.ipynb

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@
8383
"source": [
8484
"## 1. The one required piece: `scalebar_dx`\n",
8585
"\n",
86-
"`scalebar_dx` is the physical size of **one axes-unit**. The `blobs` image is indexed in pixels, so one axes-unit is one pixel; at our assumed resolution that is 0.5 µm. Pass that as `scalebar_dx`, and the unit it is measured in as `scalebar_units`. Note that `scalebar_dx` should be a float."
86+
"`scalebar_dx` is the physical size of **one axes-unit**. The `blobs` image is indexed in pixels, so one axes-unit is one pixel; at our assumed resolution that is 0.5 µm. Pass that as `scalebar_dx` (a float), and the unit it is measured in as `scalebar_units`."
8787
]
8888
},
8989
{
@@ -139,7 +139,7 @@
139139
"source": [
140140
"## 2. Units and auto-scaling\n",
141141
"\n",
142-
"`scalebar_units` is simply the unit your `scalebar_dx` is expressed in. matplotlib-scalebar then picks a human-friendly magnitude automatically: a bar spanning thousands of µm is shown in mm. The same image at a coarse 50 µm/pixel gives a bar labelled in mm:"
142+
"`scalebar_units` is simply the unit your `scalebar_dx` is expressed in. In the background, it uses [matplotlib-scalebar](https://pypi.org/project/matplotlib-scalebar/), which picks a human-friendly magnitude automaticallya bar spanning thousands of µm is relabelled in mm. Here the same image at a coarse 50 µm/pixel crosses that threshold:"
143143
]
144144
},
145145
{
@@ -181,7 +181,7 @@
181181
"source": [
182182
"## 3. Placement and appearance with `scalebar_params`\n",
183183
"\n",
184-
"`scalebar_params` is a dict forwarded **verbatim** to matplotlib-scalebar's `ScaleBar`, so every option it supports is available. The ones you will reach for most:\n",
184+
"`scalebar_params` is a dict forwarded to matplotlib-scalebar's `ScaleBar`, so every option it supports is available. The ones you will reach for most:\n",
185185
"\n",
186186
"- `location` — which corner (`\"lower right\"`, `\"upper left\"`, …).\n",
187187
"- `color` — bar and text colour (use white on dark images).\n",
@@ -348,10 +348,34 @@
348348
},
349349
{
350350
"cell_type": "code",
351-
"execution_count": null,
351+
"execution_count": 1,
352352
"id": "8737ae6c",
353353
"metadata": {},
354-
"outputs": [],
354+
"outputs": [
355+
{
356+
"name": "stdout",
357+
"output_type": "stream",
358+
"text": [
359+
"Python implementation: CPython\n",
360+
"Python version : 3.14.4\n",
361+
"IPython version : 9.13.0\n",
362+
"\n",
363+
"spatialdata : 0.7.3\n",
364+
"spatialdata_plot : 0.4.0\n",
365+
"matplotlib : 3.10.9\n",
366+
"matplotlib_scalebar: 0.9.0\n",
367+
"\n",
368+
"Compiler : Clang 20.1.8 \n",
369+
"OS : Darwin\n",
370+
"Release : 25.2.0\n",
371+
"Machine : arm64\n",
372+
"Processor : arm\n",
373+
"CPU cores : 8\n",
374+
"Architecture: 64bit\n",
375+
"\n"
376+
]
377+
}
378+
],
355379
"source": [
356380
"# ruff: noqa: F401, F811, I001, E402\n",
357381
"# fmt: off\n",
@@ -365,9 +389,9 @@
365389
],
366390
"metadata": {
367391
"kernelspec": {
368-
"display_name": "Python 3",
392+
"display_name": "sdata-plot-notebooks",
369393
"language": "python",
370-
"name": "python3"
394+
"name": "sdata-plot-notebooks"
371395
},
372396
"language_info": {
373397
"codemirror_mode": {
@@ -379,9 +403,9 @@
379403
"name": "python",
380404
"nbconvert_exporter": "python",
381405
"pygments_lexer": "ipython3",
382-
"version": "3.13.7"
406+
"version": "3.14.4"
383407
}
384408
},
385409
"nbformat": 4,
386410
"nbformat_minor": 5
387-
}
411+
}

0 commit comments

Comments
 (0)