scale-linetype-binned
Binned linetype scale: cuts a continuous variable into n-breaks bins, each bin gets one dash keyword from palette.
The scale stays continuous: the trained domain is numeric and the resolver snaps each row to the bin its value falls into.
Usage
scale-linetype-binned(
n-breaks: 4,
palette: auto,
name: none,
limits: none,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
n-breaks |
4 |
Number of bins to partition the continuous domain into. |
palette |
auto |
Array of dash keywords, one per bin, or auto for the library default. |
name |
none |
Legend title. Overrides any name set via labs when both are present. |
limits |
none |
Continuous (lo, hi) pair pinning the domain, or none. |
labels |
auto |
Array of legend labels aligned with bin midpoints, or auto. |
Returns
Scale object consumed by plot.
Examples
Bin a continuous quality column into three linetype buckets.
#let d = range(1, 13).map(i => (x: i, y: i, q: i))
#plot(
data: d,
mapping: aes(x: "x", y: "y", linetype: "q", group: "q"),
layers: (geom-line(stroke: 1pt),),
scales: (scale-linetype-binned(n-breaks: 3),),
width: 10cm,
height: 6cm,
)