scale-colour-stepsn
Binned n-stop colour gradient.
Walks colours as a sequence of stops and quantises the lookup into n-breaks equal-width bins.
Usage
scale-colour-stepsn(
..args,
)Parameters
| Parameter | Default | Description |
|---|---|---|
..args |
Returns
Scale object consumed by plot.
Examples
Three-stop ramp discretised into six bins.
#let d = range(0, 12).map(i => (x: i, y: i, z: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "z"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-stepsn(colours: (
rgb("#1a9850"), rgb("#ffffbf"), rgb("#d73027"),
), n-breaks: 6),),
width: 10cm,
height: 6cm,
)Reuse a brewer palette as the stop list to fold a discrete palette into a banded continuous scale.
#let d = range(0, 12).map(i => (x: i, y: i, z: i * 0.5))
#plot(
data: d,
mapping: aes(x: "x", y: "y", colour: "z"),
layers: (geom-point(size: 3pt),),
scales: (scale-colour-stepsn(
colours: brewer-palette("YlOrRd"),
n-breaks: 5,
),),
width: 10cm,
height: 6cm,
)