scale-y-reverse
Continuous y scale flipped bottom-to-top.
Thin wrapper over scale-y-continuous with transform: "reverse". Tick labels stay in data units; only the axis direction reverses.
Usage
scale-y-reverse(
name: none,
limits: none,
oob: "drop",
breaks: auto,
minor-breaks: auto,
n-minor: auto,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
name |
none |
Axis title. Overrides any name set via labels when both are present. |
limits |
none |
Pair (lo, hi) clipping the trained domain, or none for automatic limits. Either element may be auto to keep the trained bound on that side. |
oob |
"drop" |
Out-of-range policy: "drop" (default) removes rows whose value falls outside limits; "squish" clamps them to the nearest endpoint. |
breaks |
auto |
Array of break values, or auto for automatic tick selection. |
minor-breaks |
auto |
Array of minor gridline positions, or auto to derive them automatically (midpoints between major breaks, extended one step beyond each end). |
n-minor |
auto |
Number of minor gridlines between adjacent major breaks when minor-breaks is auto; auto resolves to 1. |
labels |
auto |
Array of tick labels aligned with breaks, or auto. |
Returns
Scale object consumed by plot.
Examples
Reverse the y axis so larger values sit at the bottom.
#let d = range(1, 11).map(i => (x: i, y: i))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-reverse(name: "y"),),
width: 10cm,
height: 6cm,
)Useful for ranking displays where rank 1 should sit at the top.
#let d = (
(team: "A", rank: 1),
(team: "B", rank: 2),
(team: "C", rank: 3),
(team: "D", rank: 4),
)
#plot(
data: d,
mapping: aes(x: "team", y: "rank"),
layers: (geom-point(size: 4pt),),
scales: (scale-y-reverse(name: "Rank", breaks: (1, 2, 3, 4)),),
width: 10cm,
height: 6cm,
)