scale-colour-steps

Binned two-stop colour gradient.

Quantises the trained continuous domain into n-breaks equal-width bins and fills each bin with a single colour drawn from the low to high ramp. Defaults to a blue ramp.

Usage

scale-colour-steps(
  ..args,
)

Parameters

Parameter Default Description
..args

Returns

Scale object consumed by plot.

Examples

Five-bin discretisation of the default low-to-high blue ramp.

#let d = range(0, 12).map(i => (x: i, y: i, z: i * 1.0))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "z"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-steps(n-breaks: 5),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into five stepped bands along the default two-stop blue ramp from dark navy to light sky-blue.

Scatter chart of twelve diagonal points where z is cut into five stepped bands along the default two-stop blue ramp from dark navy to light sky-blue.

Custom low/high colours discretised into eight bins.

#let d = range(0, 12).map(i => (x: i, y: i, z: i * 1.0))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", colour: "z"),
  layers: (geom-point(size: 3pt),),
  scales: (scale-colour-steps(
    low: rgb("#fee5d9"),
    high: rgb("#a50f15"),
    n-breaks: 8,
  ),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of twelve diagonal points where z is cut into eight stepped bands along a custom two-stop ramp from pale peach to deep crimson.

Scatter chart of twelve diagonal points where z is cut into eight stepped bands along a custom two-stop ramp from pale peach to deep crimson.

See also

scale-colour-steps2, scale-colour-stepsn, scale-fill-steps.

Back to top