scale-stroke-binned
Binned continuous stroke scale.
Maps a numeric column onto an outline-thickness range, but groups values into n-breaks bins for the legend.
Usage
scale-stroke-binned(
n-breaks: 4,
range: (0.2pt, 1.4pt),
name: none,
limits: none,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
n-breaks |
4 |
Number of legend bins. |
range |
(0.2pt, 1.4pt) |
Pair of Typst lengths (min, max) bounding the output thickness. |
name |
none |
Legend title. |
limits |
none |
Pair (lo, hi) clipping the trained domain, or none. |
labels |
auto |
Array of legend labels aligned with breaks, or auto. |
Returns
Scale object consumed by plot.
Examples
Bucket a continuous w column into three thickness bands while still feeding a numeric range to the scale.
#let d = range(1, 13).map(i => (x: i, y: i, w: i))
#plot(
data: d,
mapping: aes(x: "x", y: "y", stroke: "w"),
layers: (geom-point(size: 5pt, fill: rgb("#1f77b4")),),
scales: (scale-stroke-binned(n-breaks: 3, range: (0.2pt, 1.6pt)),),
width: 10cm,
height: 6cm,
)