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. |
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 of numbers or ISO-8601 strings, where either side may beautoto train that side from the data;none(default) trains both sides.oob: Handling of rows outsidelimits:"drop"(default) removes them,"squish"clamps them to the nearest limit.breaks: Array of tick positions in the scale’s numeric units, a bare number for a single tick, a function of the trained values returning positions (thebreaks-*helpers return such a function), orauto(default) for computed breaks.labels: Array of labels aligned with the breaks, a function of the break value returning a string or content (theformat-*helpers return such a function), orauto(default) to format each break.expand: Padding around the domain as a ratio (5%), a length (5pt), arelative, or a(lo, hi)pair whose sides may each beauto;falseornoneremoves it.auto(default) pads 5% per side.date-format: Typstdatetime.displayformat string; default “[year]-[month repr:numerical]-[day] [hour]:[minute]”.
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,
)