scale-gradient2

Diverging three-colour gradient colour/fill scale.

Interpolates low-mid-high around midpoint.

Usage

scale-gradient2(
  ..args,
)

Parameters

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

Returns

Deferred scale spec consumed by scales.

Examples

Diverge a signed numeric fill around zero.

#let d = range(0, 11).map(i => (x: i, y: i, w: i - 5))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", fill: "w"),
  layers: (geom-point(size: 5pt),),
  scales: scales(fill: scale-gradient2(midpoint: 0)),
  width: 10cm,
  height: 6cm,
)

Scatter chart of eleven diagonal points whose fill diverges from a low colour through white to a high colour around a midpoint of zero.

Scatter chart of eleven diagonal points whose fill diverges from a low colour through white to a high colour around a midpoint of zero.

See also

scales, scale-gradient, scale-gradientn.

Back to top