scale-fill-grey

Discrete grey fill scale.

Fill counterpart of scale-colour-grey.

Usage

scale-fill-grey(
  start,
  end,
  name,
  limits,
  oob,
  labels,
)

Parameters

Parameter Default Description
start Luminance for the first level, in [0, 1].
end Luminance for the last level, in [0, 1].
name Legend title. Overrides any name set via labels when both are present.
limits Array of level names controlling order and inclusion, or none.
oob Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps continuous values to the nearest endpoint.
labels Array of legend labels aligned with limits, or auto.

Returns

Scale object consumed by plot.

Examples

Default grey ramp shown as a swatch strip via geom-rect.

#let levels = ("a", "b", "c", "d", "e", "f")
#let d = levels.enumerate().map(((i, k)) => (
  xmin: i, xmax: i + 1, ymin: 0, ymax: 1, k: k,
))
#plot(
  data: d,
  mapping: aes(xmin: "xmin", xmax: "xmax", ymin: "ymin", ymax: "ymax", fill: "k"),
  layers: (geom-rect(),),
  scales: (scale-fill-grey(),),
  guides: guides(fill: none),
  theme: theme-void(),
  width: 8cm,
  height: 1cm,
)

Legend swatch strip of six rectangles stepping evenly from dark grey on the left to light grey on the right along the default grey fill ramp.

Legend swatch strip of six rectangles stepping evenly from dark grey on the left to light grey on the right along the default grey fill ramp.

See also

scale-colour-grey, scale-fill-discrete.

Back to top