stat-bindot
Dot-density bin statistic: emit one stacked row per observation.
Either bins or binwidth fixes the partition; binwidth wins when both are supplied. The y column carries each observation’s stack index within its bin, so geom-dotplot can place dots at increasing heights.
Usage
stat-bindot(
bins: 30,
binwidth: none,
stackratio: 1.0,
)Parameters
| Parameter | Default | Description |
|---|---|---|
bins |
30 |
Target number of bins when binwidth is none. |
binwidth |
none |
Fixed bin width. Overrides bins when set. |
stackratio |
1.0 |
Vertical spacing between stacked dots, in dot units. 1 means touching. |
Returns
Statistic object with name: "bindot", consumed by geom-dotplot.
Outputs
x.y._bin-count.width.
Examples
stat-bindot powers geom-dotplot; forward binwidth (or bins) through the wrapper to stack each observation within a half-unit bucket.
#let d = range(0, 40).map(i => (
x: calc.sin(i * 0.4) * 3 + calc.cos(i * 0.7) * 2,
))
#plot(
data: d,
mapping: aes(x: "x"),
layers: (geom-dotplot(binwidth: 0.5),),
width: 10cm,
height: 6cm,
)