scale-y-sqrt
Continuous y scale on a square-root axis.
Thin wrapper over scale-y-continuous with transform: "sqrt". All y values must be non-negative.
Usage
scale-y-sqrt(
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
Square-root y axis straightens a quadratic relationship.
#let d = range(0, 11).map(i => (x: i, y: i * i))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-sqrt(name: "y"),),
width: 10cm,
height: 6cm,
)Combine with limits to highlight a specific range without changing the underlying data.
#let d = range(0, 11).map(i => (x: i, y: i * i))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-sqrt(name: "y", limits: (0, 64)),),
width: 10cm,
height: 6cm,
)