Skip to content

Type Alias: ViolinTrace ​

ts
type ViolinTrace = CommonTraceAttributes & CartesianTraceAttributes & object;

Violin plot: a kernel density estimate of samples at each position, mirrored (or one-sided), with an optional inner box plot, mean line and points.

Type Declaration ​

NameTypeDescription
alignmentgroup?stringTraces on the same position axis with the same alignment group split each position between their offset groups; different alignment groups lay out independently.
bandwidth?numberBandwidth of the Gaussian kernel density estimate, in value-axis units. Default: Silverman's rule, 1.059 · min(sd, IQR / 1.349) · n^(−1/5) (at least 1% of the sample range). Minimum: 0
box?ViolinTraceBoxThe box plot drawn inside the violin.
fillcolor?stringFill color of the violin. Default: line.color at half opacity.
hoveron?| "violins" | "points" | "kde" | "violins+points" | "violins+kde" | "points+violins" | "points+kde" | "kde+violins" | "kde+points" | "violins+points+kde" | "violins+kde+points" | "points+violins+kde" | "points+kde+violins" | "kde+violins+points" | "kde+points+violins" | "all"What shows hover labels: the violins (one label per statistic), the points, and the density at the pointer (kde, a label on the violin edge; its value is relative to the scale group’s peak).
jitter?numberRandom spread of the points across the position axis, as a fraction of the violin width (0: all on one line). Denser stretches spread more. Default: 0.3 with points: 'all', else 0. The spread is repeatable (Plotly's seeded generator). Range: 0 – 1
line?ViolinTraceLineOutline of the violin.
marker?ViolinTraceMarkerStyle of the sample points.
meanline?ViolinTraceMeanlineThe mean line.
offsetgroup?stringWith layout.violinmode: 'group', traces with the same offset group share one slot at each position; different offset groups sit side by side.
orientation?"v" | "h"'v': vertical violines at x positions over y values; 'h': horizontal ones at y positions. Default: 'v' when y is given, else 'h'.
pointpos?numberWhere the points sit relative to the violin, in violin half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one violin width to the left (or below). Default: −1.5 with points: 'all', else 0. Range: -2 – 2
points?"all" | "outliers" | "suspectedoutliers" | falseWhich samples are drawn as points: 'all', only those beyond the whiskers ('outliers', the default), those plus a highlight of the ones between the whiskers and 3 IQR from the quartiles ('suspectedoutliers', styled by marker.outliercolor and marker.line.outlier*), or none (false). Default: 'suspectedoutliers' when an outlier color is set, else 'outliers'.
quartilemethod?"linear" | "exclusive" | "inclusive"How quartiles are computed from samples: linear interpolates over the whole sample (Plotly's method, the one most tools call type 5); for odd counts, exclusive takes the medians of the lower and upper halves without the median, inclusive with it. Even counts use linear in every method.
scalegroup?stringViolins of traces with the same scale group are scaled together (by scalemode), so their widths compare. Default: the trace name, so each trace is scaled on its own. Violins scale together within a subplot.
scalemode?"width" | "count"'width': the widest violin of the scale group fills its slot; 'count': widths are also proportional to each violin's sample count.
selected?ViolinTraceSelectedStyle of selected points while a selection is active.
side?"both" | "positive" | "negative"Which half of the violin is drawn: both, only the positive side (right of, or above, the position) or the negative one. Two traces at the same positions with opposite sides make split violins.
span?readonly unknown[]The value range of the density with spanmode: 'manual'; a missing end falls back to the soft end.
spanmode?"soft" | "hard" | "manual"How far the density is drawn: soft two bandwidths past the extreme samples, hard exactly to them, manual over span. Default: manual when span is set.
text?PerPoint<string | number>Text per sample, shown in the hover label of its point.
type"violin"Trace type.
unselected?ViolinTraceUnselectedStyle of unselected points while a selection is active.
width?numberViolin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and layout.violingap, violingroupgap and violinmode. Minimum: 0
x?DataColumnx samples: the values of horizontal violines when y is not given, else the position of each sample (one violin per distinct x) for vertical violines.
x0?unknownPosition of the violin when x is not given. Default: the trace name on category axes (and numeric or date names on linear, log and date axes), else the violin's index among the violin traces.
y?DataColumny samples: the values of horizontal violines when x is not given, else the position of each sample (one violin per distinct y) for vertical violines.
y0?unknownPosition of the violin when y is not given. Default: the trace name on category axes (and numeric or date names on linear, log and date axes), else the violin's index among the violin traces.
zorder?numberStacking order among the traces of a subplot: higher is drawn on top. At equal zorder, violins draw below boxes and both below scatter traces (Plotly’s layer order), then in trace order.

Released under the MIT License.