scale-y-binned
Binned continuous y scale: quantises a numeric axis into n-breaks bins.
Counterpart of scale-x-binned for the y axis.
Usage
scale-y-binned(
name: none,
limits: none,
oob: "drop",
n-breaks: 10,
breaks: 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. 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. |
n-breaks |
10 |
Number of bins to partition the domain into. Ignored when breaks is set. |
breaks |
auto |
Array of bin edges, or auto to derive equal-width bins from n-breaks. Edges define the bin boundaries; ticks sit at each interval midpoint and the domain widens to cover them. |
labels |
auto |
Array of tick labels aligned with the bin midpoints, or auto. |
Returns
Scale object consumed by plot.
Examples
Five equal-width bins along the y axis.
#let d = range(0, 30).map(i => (x: i, y: i / 3.0))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-binned(n-breaks: 5),),
width: 10cm,
height: 6cm,
)A finer ten-bin partition with limits clipping the lower tail.
#let d = range(0, 30).map(i => (x: i, y: i / 3.0))
#plot(
data: d,
mapping: aes(x: "x", y: "y"),
layers: (geom-point(size: 2pt),),
scales: (scale-y-binned(n-breaks: 10, limits: (2, 9)),),
width: 10cm,
height: 6cm,
)