scale-fill-continuous

Continuous fill scale mapping a numeric column to fill colours.

Usage

scale-fill-continuous(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Default ramp filling bars by their numeric value.

#let d = (
  (grp: "a", y: 1),
  (grp: "b", y: 2),
  (grp: "c", y: 3),
)
#plot(
  data: d,
  mapping: aes(x: "grp", y: "y", fill: "y"),
  layers: (geom-col(),),
  scales: (scale-fill-continuous(),),
  width: 10cm,
  height: 6cm,
)

Bar chart of three bars a, b, c filled along the default continuous blue ramp from dark navy at low y to light sky-blue at high y.

Bar chart of three bars a, b, c filled along the default continuous blue ramp from dark navy at low y to light sky-blue at high y.

The default ramp shown as a continuous swatch via geom-rect over a sampled gradient.

#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-continuous(),),
  guides: guides(fill: guide-none()),
  width: 10cm,
  height: 1cm,
)

Colour-bar swatch of sixteen rectangles displaying the default continuous fill ramp from dark navy on the left to light sky-blue on the right.

Colour-bar swatch of sixteen rectangles displaying the default continuous fill ramp from dark navy on the left to light sky-blue on the right.

See also

scale-fill-viridis-c, scale-fill-discrete, scale-colour-continuous.

Back to top