scale-alpha-identity

Alpha scale that uses each row’s value as the opacity directly.

Values are clamped to [0, 1] before being applied to the colour. No legend is drawn because the column carries the visual outcome verbatim.

Usage

scale-alpha-identity(
  name: none,
)

Parameters

Parameter Default Description
name none Legend title. Identity scales draw no legend.

Returns

Scale object consumed by plot.

Examples

Per-row opacity carried straight through to the point fills.

#let d = (
  (x: 1, y: 2, w: 0.2),
  (x: 2, y: 3, w: 0.5),
  (x: 3, y: 4, w: 0.8),
  (x: 4, y: 5, w: 1.0),
)
#plot(
  data: d,
  mapping: aes(x: "x", y: "y", alpha: "w"),
  layers: (geom-point(size: 6pt, fill: rgb("#1f77b4")),),
  scales: (scale-alpha-identity(),),
  width: 10cm,
  height: 6cm,
)

Scatter chart of four blue points where the w column passes through verbatim as the fill opacity from near-transparent to fully opaque with no legend.

Scatter chart of four blue points where the w column passes through verbatim as the fill opacity from near-transparent to fully opaque with no legend.

See also

scale-alpha-continuous, scale-colour-identity.

Back to top