scale-colour-steps
Binned two-stop colour gradient.
Quantises the trained continuous domain into n-breaks equal-width bins and fills each bin with a single colour drawn from the low to high ramp. Defaults to a blue ramp.
Usage
scale-colour-steps(
..args,
)Parameters
| Parameter | Default | Description |
|---|---|---|
..args |
Returns
Scale object consumed by plot.
Examples
Five-bin discretisation of the default low-to-high blue ramp.
#let d = range(0, 12).map(i => (x: i, y: i, z: i * 1.0))
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "z"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-steps(n-breaks: 5),),
width: 10cm,
height: 6cm,
)Custom low/high colours discretised into eight bins.
#let d = range(0, 12).map(i => (x: i, y: i, z: i * 1.0))
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "z"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-steps(
low: rgb("#fee5d9"),
high: rgb("#a50f15"),
n-breaks: 8,
),),
width: 10cm,
height: 6cm,
)