violin

violinNode

A sample drawn as the shape of its density: a kernel density estimate of the readings, mirrored about the line the violin stands on, wide where readings crowd and narrow where they thin, and cut off square at the smallest and largest reading rather than drawn past them. Where a box keeps five numbers and throws the shape away, a violin keeps the shape, so two humps are two humps. It stands exactly as a boxplot does — a lane above the number line, one sample at an on:, or a violin at every name where its other coordinate is a column of names — and a violin, a box and a scatter of the same readings at one place share one slot, so a narrow box inside its violin is two lines. Each violin is as wide as width: of its slot at its own peak, so the shapes compare and the counts do not. Refused with both coordinates numeric, which leaves no line to stand on, and on the polar plane.

Only withxxyargandplane

#Attributes

On any plane

bandwidthAnimatable
The width of the kernel each reading is smoothed over, in the readings' own units. Left out, each sample takes Silverman's rule of thumb, 0.9 × min(σ, IQR ÷ 1.34) × n^(−1/5). Smaller shows every bump in the sample and larger smooths them away; parametised, so a reader dragging a slider watches bumps appear and dissolve. A written number must be positive.
colourAnimatable
neutralredorangeyellowgreentealbluepurplepinkgreywhiteblack
Also written: colorColour.
Defaultpurple
widthAnimatable
The share of its slot a violin is wide at its peak — the same room a boxplot's and a scatter's width: are shares of, so a narrow box sits inside a wide violin by giving each its own share.
Default0.8
opacityAnimatable
Opacity.
Default1
Text drawn beside the element — rich text, so $maths$ and inline formatting render. Fades and draws with the element.
hiddenAnimatable
Declared but not drawn. Animatable — hidden: true !cue.to{false}(at: 2) reveals it — and unlike a cue, a hidden element still frames the plot and holds its slot, so nothing moves when it appears.
Defaultfalse
Also written: lockedKeeps the reader from editing this element on an editable: graph. Nothing at all on a graph that is not editable.
Defaultfalse
text-sizeAnimatable
Text size.
Default20
layerAnimatable
Paint order among the marks: a higher layer is drawn later, on top; equal or omitted, the marks stack in document order (later on top).
Only withxplane
xImplicitAnimatable
The readings — numbers written out, or a dataset column bound whole. The sample itself, not a density worked out by hand. One coordinate is one sample; x: and y: together, with one axis ruled in names, are a sample grouped by those names, a violin at each.Can be written as shorthand: violin:value
Only withxyplane
xImplicitAnimatable
The readings — numbers written out, or a dataset column bound whole. The sample itself, not a density worked out by hand. One coordinate is one sample; x: and y: together, with one axis ruled in names, are a sample grouped by those names, a violin at each.Can be written as shorthand: violin:value
yAnimatable
The readings when the sample is measured up the y axis, or the names column of a grouped violin whose readings are on x.
onAnimatable
Where a one-sample violin stands on the other axis — a number, a name, or a date, as a boxplot's on:. Required on a plane for a violin written with one coordinate; refused on the number line, whose violins take lanes, and on a grouped violin, whose names column already says where.
Only withargandplane
reAnimatable
The readings on the real axis, on the argand plane.
imAnimatable
The readings on the imaginary axis, on the argand plane.
onAnimatable
Where a one-sample violin stands on the other axis — a number, a name, or a date, as a boxplot's on:. Required on a plane for a violin written with one coordinate; refused on the number line, whose violins take lanes, and on a grouped violin, whose names column already says where.

#Allowed in

#Examples

violin(x: 2, 3, 3, 4, 4, 5, 7, 8, 8, 9)
violin(x: #penguins.flipper; y: #penguins.species)
violin(y: #trial.mass; on: control; bandwidth: 0.4)