scale-time

Temporal position scale formatting axis labels as times (x or y).

Usage

scale-time(
  ..args,
)

Parameters

Parameter Default Description
..args Named arguments forwarded to the axis scale (e.g. name, limits, breaks, labels, expand, date-format).

Returns

Deferred scale spec consumed by scales.

Examples

Label a y axis of elapsed seconds as times of day.

#let d = range(0, 7).map(i => (x: i, y: i * 900))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-line(),),
  scales: scales(y: scale-time()),
  width: 12cm,
  height: 6cm,
)

Line chart of seven rising points on a y axis whose ticks read as hour-and-minute times decoded from elapsed seconds.

Line chart of seven rising points on a y axis whose ticks read as hour-and-minute times decoded from elapsed seconds.

See also

scales, scale-date, scale-datetime.

Back to top