GeomDensity
Density geometry: a smooth kernel density estimate of a continuous x variable, drawn as a filled area — a smoothed histogram alternative. One curve per group. Do NOT map aes.y — the density stat computes it.
Defaults
- geom
density- default stat
density- default position
identity- params type
DensityParams
Svelte component
import { GGPlot, GeomDensity } from "@ggsvelte/svelte";
<GGPlot data={rows} aes={{ x: "x" }}>
<GeomDensity />
</GGPlot> JSON layer
{
"geom": "density",
"stat": "density"
} Params
bwnumberKernel bandwidth in data units (must be greater than 0). Omit for R's bw.nrd0 rule-of-thumb default.
adjustnumberBandwidth multiplier (must be greater than 0). Default 1. 0.5 = half the default bandwidth (wigglier), 2 = double (smoother).
nnumberNumber of grid points the density is evaluated at (an integer between 2 and 4096). Default 512 (the R default).
cutnumberThe grid extends cut * bandwidth beyond the data extremes (at least 0). Default 3 (the R default).
alphanumberArea fill opacity. Must be between 0 and 1 (inclusive). Default 1.
fillPaintGradientPaintWithin-mark gradient fill paint (not a data scale). Requires a solid fallback.
glowGlowSpecBounded within-mark glow treatment (not theme decoration).
Allowed stats
densitydefault
Allowed positions
identitydefault