ViolinPlot
Builder for creating violin plots. Estimates the probability density of each group using kernel density estimation (KDE) and renders the result as a symmetric shape — wider where data is dense, narrower where it is sparse. Unlike box plots, violins reveal multi-modal and skewed distributions. Bandwidth defaults to Silverman’s rule-of-thumb. Individual data points can be overlaid as a jittered strip or beeswarm.Constructor
Create a violin plot with default settings.Defaults:
- Color:
"black" - Width:
30.0pixels (half-width) - Silverman bandwidth
- 200 KDE evaluation points
- Overlay color:
"rgba(0,0,0,0.45)" - Overlay point size:
3.0pixels - No overlay
Data Methods
Styling Methods
"steelblue").30.0). The widest point of the violin is scaled to this value. Increase it to make violins more prominent, decrease it for a narrower look. Note this is in pixel units, unlike bar-width which is a fractional slot.KDE Methods
200). Higher values produce a smoother curve at the cost of slightly more computation. The default is adequate for most use cases.Overlay Methods
jitter controls the horizontal spread (in data-axis units). A value of 0.15–0.2 is typical. Use a semi-transparent with_overlay_color so the violin shape remains visible underneath."rgba(0,0,0,0.45)"). A semi-transparent color is strongly recommended so the KDE shape behind the points remains legible.3.0).Legend Methods
Types
ViolinGroup
A single group (one violin) with a category label and raw values. Fields:label: String- Category labelvalues: Vec<f64>- Raw data values