scale-fill-gradientn

Continuous n-stop fill gradient.

Fill counterpart of scale-colour-gradientn.

Usage

scale-fill-gradientn(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Three-stop ramp shown as a continuous swatch via geom-rect.

#let d = range(0, 16).map(i => (
  xmin: i, xmax: i + 1, ymin: 0, ymax: 1, z: i,
))
#plot(
  data: d,
  mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "z"),
  layers: (geom-rect(),),
  scales: (scale-fill-gradientn(colours: (
    rgb("#1a9850"), rgb("#ffffbf"), rgb("#d73027"),
  )),),
  guides: guides(fill: guide-none()),
  width: 10cm,
  height: 1cm,
)

Colour-bar swatch of sixteen rectangles displaying an n-stop fill gradient passing green through pale yellow to red across the bar.

Colour-bar swatch of sixteen rectangles displaying an n-stop fill gradient passing green through pale yellow to red across the bar.

See also

scale-colour-gradientn, scale-fill-gradient, scale-fill-gradient2.

Back to top