scale-stepsn

Binned N-colour gradient colour/fill scale (stepsn).

Usage

scale-stepsn(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the colour/fill scale (e.g. colours, n-breaks, breaks, name, limits, labels).

Returns

Deferred scale spec consumed by scales.

Examples

Bin a numeric fill into N-colour stepped bands.

#let d = range(0, 12).map(i => (x: i, y: i, w: i + 1))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", fill: "w"),
  layers: (geom-point(size: 5pt),),
  scales: scales(fill: scale-stepsn(
    colours: (rgb("#000000"), rgb("#888888"), rgb("#ffffff")),
    n-breaks: 4,
  )),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points whose fill steps through binned bands drawn from a three-colour ramp.

Scatter chart of twelve diagonal points whose fill steps through binned bands drawn from a three-colour ramp.

See also

scales, scale-gradientn, scale-steps.

Back to top