scale-datetime

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

Usage

scale-datetime(
  ..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 clock times.

#let d = range(0, 7).map(i => (x: i, y: i * 3600))
#plot(
  data: d,
  mapping: aes(x: "x", y: "y"),
  layers: (geom-line(),),
  scales: scales(y: scale-datetime(date-format: "[hour]:[minute]")),
  width: 12cm,
  height: 6cm,
)

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

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

See also

scales, scale-date, scale-time.

Back to top