scale-log10

Position scale on a base-10 log axis (x or y).

All mapped values must be strictly positive.

Usage

scale-log10(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the axis scale.

Keys accepted by ..args:

  • name: Axis or legend title, as a string or content; none (default) falls back to the mapped column name.
  • limits: Domain as a (lo, hi) pair, where either side may be auto to train that side from the data; none (default) trains both sides.
  • oob: Handling of rows outside limits: "drop" (default) removes them, "squish" clamps them to the nearest limit.
  • breaks: Array of tick positions in data units, a bare number for a single tick, a function of the trained values returning positions (the breaks-* helpers return such a function), or auto (default) for computed breaks.
  • minor-breaks: Array of minor-gridline positions in data units, a function of the trained values returning positions (the breaks-* helpers return such a function), or auto (default) to subdivide the majors, halfway between them in transformed space.
  • n-minor: Integer count of minor gridlines between adjacent majors, or auto (default) for one; ignored when minor-breaks is set.
  • labels: Array of labels aligned with the breaks, a function of the break value returning a string or content (the format-* helpers return such a function), or auto (default) to format each break.

Returns

Deferred scale spec consumed by scales.

Examples

Compress an exponential growth curve onto a log-10 y axis.

#let d = range(1, 11).map(i => (x: i, y: calc.pow(2, i)))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-point(size: 2pt),),
  scales: scales(y: scale-log10(name: "Value")),
  width: 10cm,
  height: 6cm,
)

Scatter chart of ten exponential values where a log10 y axis compresses the steep curve into an evenly spaced sequence of points.

Scatter chart of ten exponential values where a log10 y axis compresses the steep curve into an evenly spaced sequence of points.

See also

scales, scale-continuous, scale-sqrt.

Back to top