scale-fill-steps
Binned two-stop fill gradient.
Fill counterpart of scale-colour-steps.
Usage
scale-fill-steps(
low,
high,
n-breaks,
breaks,
name,
limits,
oob,
labels,
)Parameters
| Parameter | Default | Description |
|---|---|---|
low |
Colour for the low end of the domain. | |
high |
Colour for the high end of the domain. | |
n-breaks |
Number of bins to partition the domain into. Ignored when breaks is set. |
|
breaks |
Array of bin edges, or auto to derive equal-width bins from n-breaks. Edges define the bin boundaries; n-breaks is ignored when set. |
|
name |
Legend title. Overrides any name set via labels when both are present. |
|
limits |
Pair (lo, hi) clipping the trained domain, or none. |
|
oob |
Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint. |
|
labels |
Array of legend labels aligned with the bins, or auto. |
Returns
Scale object consumed by plot.
Examples
Five-bin discretised fill ramp shown as a swatch via geom-rect.
#let d = range(0, 16).map(i => (
xmin: i, xmax: i + 1, ymin: 0, ymax: 1, z: i,
))
#plot(
data: d,
mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "z"),
layers: (geom-rect(),),
scales: (scale-fill-steps(n-breaks: 5),),
guides: guides(fill: none),
theme: theme-void(),
width: 10cm,
height: 1cm,
)