scale-y-log10
Continuous y scale on a base-10 log axis.
Thin wrapper over scale-y-continuous with transform: "log10". All y values must be strictly positive.
Usage
scale-y-log10(
name: none,
limits: none,
breaks: auto,
labels: auto,
)Parameters
| Parameter | Default | Description |
|---|---|---|
name |
none |
Axis title. Overrides any name set via labs when both are present. |
limits |
none |
Pair (lo, hi) clipping the trained domain, or none for automatic limits. |
breaks |
auto |
Array of break values, or auto for automatic tick selection. |
labels |
auto |
Array of tick labels aligned with breaks, or auto. |
Returns
Scale object consumed by plot.
Examples
Log-10 y axis turns an exponential into a near-linear shape.
#let d = range(1, 11).map(i => (x: i, y: calc.pow(2, i)))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-log10(name: "y"),),
width: 10cm,
height: 6cm,
)Combine limits and breaks to clip and label a specific log range.
#let d = range(1, 11).map(i => (x: i, y: calc.pow(2, i)))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-log10(
name: "y",
limits: (2, 1024),
breaks: (2, 8, 32, 128, 512),
),),
width: 10cm,
height: 6cm,
)