density
A sample drawn as the curve of its density: a kernel density estimate worked out from the readings themselves, so the curve is one line of chalk rather than a column of heights computed elsewhere. Which coordinate carries the readings is the axis they are measured on, and the estimate rises up the other — x: spreads them along x with the curve standing over it, y: turns the picture a quarter turn. Two coordinates are two samples with no axis left for the estimate to rise up, and are refused. Drawn only across the range the readings cover, and trimmed square at each end for the reason a violin is: a density claimed past the largest reading is a picture of measurements nobody took. The area under it is 1. bandwidth: is parametised, which is most of what this mark is for — the same readings under a bandwidth the reader is dragging, bumps appearing and flattening as they go.
Only withplane
#Attributes
x:.purplefalse$maths$ and inline formatting render. Placed at the curve's peak, which is where a family of densities is told apart.hidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot, so nothing moves when it appears.falseeditable: graph. Nothing at all on a graph that is not editable.false#Derived attributes
Computed while the element renders — read one with #id.name in attribute position or {{#id.name}} in prose, never set.
bandwidth attribute, which says what was asked for rather than what was used.#Allowed in
#Examples
density(x: #sample.height)density(x: #sample.height; bandwidth: h; colour: purple)
parameter(var: h; from: 0.2; to: 4; value: 1; label: bandwidth)density(x: #avp.income; bandwidth: 0.5; label: narrow)
density(x: #avp.income; bandwidth: 2; label: wide; colour: teal)