geom-dotplot
Dotplot layer: one dot per observation, stacked within bins.
Bins observations along x (default 30 bins), then stacks them upward inside each bin. The dot diameter is binwidth * dotsize in data units on the x-axis; stackratio controls the vertical spacing between dots (1 means dots touch).
Usage
geom-dotplot(
mapping: none,
data: none,
bins: 30,
binwidth: none,
dotsize: 1.0,
stackratio: 1.0,
fill: auto,
colour: auto,
stroke: none,
alpha: auto,
position: "identity",
inherit-aes: true,
)Parameters
| Parameter | Default | Description |
|---|---|---|
mapping |
none |
Layer-specific aesthetic mapping built with aes. Must map x. |
data |
none |
Layer-specific dataset. Falls back to the plot data when none. |
bins |
30 |
Target number of bins when binwidth is none. |
binwidth |
none |
Fixed bin width. Overrides bins when set. |
dotsize |
1.0 |
Multiplier on the dot diameter (1 keeps dots equal to binwidth). |
stackratio |
1.0 |
Vertical spacing between dots, in dot diameters. 1 means touching. |
fill |
auto |
Dot fill colour. auto resolves via the fill scale. |
colour |
auto |
Dot outline colour. auto resolves via the colour scale; only honoured when stroke is non-zero. |
stroke |
none |
Dot outline thickness; none means no outline. |
alpha |
auto |
Dot opacity in [0, 1]. |
position |
"identity" |
Position adjustment name. Usually "identity". |
inherit-aes |
true |
Whether to merge the plot-level mapping into this layer’s mapping. |
Returns
Layer dictionary consumed by plot.
Examples
Twelve-bin dotplot of a synthetic distribution.
#let d = range(0, 60).map(i => (
x: calc.sin(i * 0.27) * 3 + i * 0.08,
))
#plot(
data: d,
mapping: aes(x: "x"),
layers: (geom-dotplot(bins: 12),),
width: 10cm,
height: 4cm,
)