scale-fill-gradient

Continuous two-stop fill gradient.

Fill counterpart of scale-colour-gradient.

Usage

scale-fill-gradient(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Custom two-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-gradient(
    low: rgb("#fee5d9"),
    high: rgb("#a50f15"),
  ),),
  guides: guides(fill: guide-none()),
  width: 10cm,
  height: 1cm,
)

Colour-bar swatch of sixteen rectangles displaying a continuous two-stop fill gradient from pale peach on the left to deep crimson on the right.

Colour-bar swatch of sixteen rectangles displaying a continuous two-stop fill gradient from pale peach on the left to deep crimson on the right.

See also

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

Back to top