Skip to main content

Module violin

Module violin 

Source
Expand description

Violin plot — a mirrored kernel-density silhouette per group. The KDE (kde) is a pure function (Gaussian kernel, Silverman bandwidth) sampled on an evenly-spaced grid; ViolinView paints the mirrored density as a filled polygon and overlays the median line.

Structs§

Density
One density curve: grid[i] (the value axis) carries density dens[i].
ViolinState
Persistent, observable interaction state (FC-3). The violin’s hover readout tracks the cursor’s exact position, so the stored hover carries both the group index (into densities()) and the value the cursor maps to.
ViolinView
A violin plot: named groups of raw samples.

Enums§

ViolinEffect
FC-8: the violin plot does no I/O.
ViolinMsg
FC-2 input surface. One input: the hovered silhouette / cursor value changing (hit-tested purely in ViolinView::render, applied in ViolinView::update).

Functions§

kde
Gaussian-kernel density estimate of values, evaluated on bins evenly spaced points spanning [min, max] padded by one bandwidth. None for an empty sample.
silverman_bandwidth
Silverman’s rule-of-thumb bandwidth: 1.06 · σ · n^(−1/5). Falls back to a small positive width on a degenerate (zero-variance) sample so the kernel stays well-defined.