scale-gradientn

N-colour continuous gradient colour/fill scale.

Interpolates through the colours array.

Usage

scale-gradientn(
  ..args,
)

Parameters

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

Returns

Deferred scale spec consumed by scales.

Examples

Interpolate a numeric fill through several colours.

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

Scatter chart of seven diagonal points whose fill interpolates through a black, grey, and white colour ramp.

Scatter chart of seven diagonal points whose fill interpolates through a black, grey, and white colour ramp.

See also

scales, scale-gradient, scale-gradient2.

Back to top