Skip to content

Variable: violinAttributes ​

ts
const violinAttributes: ObjectNode<{
  alignmentgroup: Attr<
    string,
    {
      description: 'Traces on the same position axis with the same alignment group split each position between their offset groups; different alignment groups lay out independently.';
      dflt: '';
      editType: 'calc';
    }
  >;
  bandwidth: Attr<
    number,
    {
      description: "Bandwidth 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).";
      editType: 'calc';
      min: 0;
    }
  >;
  box: ObjectNode<{
    fillcolor: Attr<
      string,
      {
        description: 'Fill of the inner box. Default: the violin `fillcolor`.';
        editType: 'style';
      }
    >;
    line: ObjectNode<{
      color: Attr<
        string,
        {
          description: 'Outline color of the inner box. Default: `line.color`.';
          editType: 'style';
        }
      >;
      width: Attr<
        number,
        {
          description: 'Outline width (px) of the inner box. Default: `line.width`.';
          editType: 'style';
          min: 0;
        }
      >;
    }>;
    visible: Attr<
      boolean,
      {
        description: 'Draw a box plot inside the violin. Default: true when any other `box` attribute is set.';
        editType: 'plot';
      }
    >;
    width: Attr<
      number,
      {
        description: 'Width of the inner box as a fraction of the violin width.';
        dflt: 0.25;
        editType: 'plot';
        max: 1;
        min: 0;
      }
    >;
  }>;
  fillcolor: Attr<
    string,
    {
      description:
        | 'Fill color of the box. Default: `line.color` at half opacity.'
        | 'Fill color of the violin. Default: `line.color` at half opacity.';
      editType: 'style';
    }
  >;
  hoveron: Attr<
    | 'all'
    | 'points'
    | 'violins'
    | 'kde'
    | `points+${string}`
    | `violins+${string}`
    | `kde+${string}`,
    {
      description: '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).';
      dflt: 'violins+points+kde';
      editType: 'style';
      extras: readonly ['all'];
      flags: readonly ['violins', 'points', 'kde'];
    }
  >;
  jitter: Attr<
    number,
    {
      description:
        | "Random spread of the points across the position axis, as a fraction of the box 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)."
        | "Random spread of the points across the position axis, as a fraction of the box width (0: all on one line). Denser stretches spread more. Default: 0.3 with `boxpoints: 'all'`, else 0. The spread is repeatable (Plotly's seeded generator)."
        | "Random 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)."
        | "Random 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 `boxpoints: 'all'`, else 0. The spread is repeatable (Plotly's seeded generator).";
      editType: 'calc';
      max: 1;
      min: 0;
    }
  >;
  line: ObjectNode<{
    color: Attr<
      string,
      {
        description:
          | 'Outline color of the box. Default: `marker.color`, else the colorway.'
          | 'Outline color of the box, its median and whiskers. Default: `marker.color`, else the colorway.'
          | 'Outline color of the violin. Default: `marker.color`, else the colorway.'
          | 'Outline color of the violin, its median and whiskers. Default: `marker.color`, else the colorway.';
        editType: 'style';
      }
    >;
    width: Attr<
      number,
      {
        description: 'Outline width in CSS px.';
        dflt: 2;
        editType: 'style';
        min: 0;
      }
    >;
  }>;
  marker: ObjectNode<{
    angle: Attr<
      number,
      {
        description: 'Point rotation in degrees, clockwise.';
        dflt: 0;
        editType: 'style';
      }
    >;
    color: Attr<
      string,
      {
        description: 'Point fill color. Default: `line.color`.';
        editType: 'style';
      }
    >;
    line: ObjectNode<{
      color: Attr<
        string,
        {
          description: 'Point outline color.';
          dflt: '#444';
          editType: 'style';
        }
      >;
      outliercolor: Attr<
        string,
        {
          description: "Outline color of suspected outliers with `'suspectedoutliers'`. Default: `marker.color`. Setting it makes that mode the default.";
          editType: 'style';
        }
      >;
      outlierwidth: Attr<
        number,
        {
          description: "Outline width (px) of suspected outliers with `'suspectedoutliers'`.";
          dflt: 1;
          editType: 'style';
          min: 0;
        }
      >;
      width: Attr<
        number,
        {
          description: 'Point outline width in CSS px.';
          dflt: 0;
          editType: 'style';
          min: 0;
        }
      >;
    }>;
    opacity: Attr<
      number,
      {
        description: 'Point opacity (multiplied by the trace `opacity`).';
        dflt: 1;
        editType: 'style';
        max: 1;
        min: 0;
      }
    >;
    outliercolor: Attr<
      string,
      {
        description: "Fill of suspected outliers (between the whiskers and 3 IQR from the quartiles) with `'suspectedoutliers'`. Setting it makes that mode the default.";
        dflt: 'rgba(0, 0, 0, 0)';
        editType: 'style';
      }
    >;
    size: Attr<
      number,
      {
        description: 'Point diameter in CSS px.';
        dflt: 6;
        editType: 'calc';
        min: 0;
      }
    >;
    symbol: Attr<
      PrimitiveValue,
      {
        accepts: (value) => boolean;
        description: "Point symbol: a name (`'diamond-open'`), a Plotly numeric code, a registered custom symbol or a `'text:…'` glyph.";
        dflt: 'circle';
        editType: 'style';
        values: readonly PrimitiveValue[];
      }
    >;
  }>;
  meanline: ObjectNode<{
    color: Attr<
      string,
      {
        description: 'Mean line color. Default: `line.color`.';
        editType: 'style';
      }
    >;
    visible: Attr<
      boolean,
      {
        description: 'Draw a dashed line at the sample mean: across the inner box when it is shown, else across the violin. Default: true when `meanline.color` or `width` is set.';
        editType: 'plot';
      }
    >;
    width: Attr<
      number,
      {
        description: 'Mean line width (px). Default: `line.width`.';
        editType: 'style';
        min: 0;
      }
    >;
  }>;
  offsetgroup: Attr<
    string,
    {
      description:
        | "With `layout.boxmode: 'group'`, traces with the same offset group share one slot at each position; different offset groups sit side by side."
        | "With `layout.violinmode: 'group'`, traces with the same offset group share one slot at each position; different offset groups sit side by side.";
      dflt: '';
      editType: 'calc';
    }
  >;
  orientation: Attr<
    'v' | 'h',
    {
      description:
        | "`'v'`: vertical boxes at `x` positions over `y` values; `'h'`: horizontal ones at `y` positions. Default: `'v'` when `y` is given, else `'h'`."
        | "`'v'`: vertical violines at `x` positions over `y` values; `'h'`: horizontal ones at `y` positions. Default: `'v'` when `y` is given, else `'h'`.";
      editType: 'calc';
      values: readonly ['v', 'h'];
    }
  >;
  pointpos: Attr<
    number,
    {
      description:
        | "Where the points sit relative to the box, in box half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `points: 'all'`, else 0."
        | "Where the points sit relative to the box, in box half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `boxpoints: 'all'`, else 0."
        | "Where the points sit relative to the box, in box 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."
        | "Where the points sit relative to the box, in box 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 `boxpoints: 'all'`, else 0."
        | "Where the points sit relative to the box, in violin half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `points: 'all'`, else 0."
        | "Where the points sit relative to the box, in violin half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `boxpoints: 'all'`, else 0."
        | "Where the points sit relative to the box, 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."
        | "Where the points sit relative to the box, 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 `boxpoints: 'all'`, else 0."
        | "Where the points sit relative to the violin, in box half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `points: 'all'`, else 0."
        | "Where the points sit relative to the violin, in box half-widths: 0 on its center line, 1 on its right (or top) edge, −2 one box width to the left (or below). Default: −1.5 with `boxpoints: 'all'`, else 0."
        | "Where the points sit relative to the violin, in box 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."
        | "Where the points sit relative to the violin, in box 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 `boxpoints: 'all'`, else 0."
        | "Where 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 box width to the left (or below). Default: −1.5 with `points: 'all'`, else 0."
        | "Where 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 box width to the left (or below). Default: −1.5 with `boxpoints: 'all'`, else 0."
        | "Where 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."
        | "Where 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 `boxpoints: 'all'`, else 0.";
      editType: 'calc';
      max: 2;
      min: -2;
    }
  >;
  points: Attr<
    false | 'all' | 'outliers' | 'suspectedoutliers',
    {
      description:
        | "Which 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'`."
        | "Which 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, `'all'` with precomputed statistics, else `'outliers'`."
        | "Which 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`, the whiskers then reach the extreme samples). Default: `'suspectedoutliers'` when an outlier color is set, else `'outliers'`."
        | "Which 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`, the whiskers then reach the extreme samples). Default: `'suspectedoutliers'` when an outlier color is set, `'all'` with precomputed statistics, else `'outliers'`.";
      editType: 'calc';
      values: readonly ['all', 'outliers', 'suspectedoutliers', false];
    }
  >;
  quartilemethod: Attr<
    'linear' | 'exclusive' | 'inclusive',
    {
      description: "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.";
      dflt: 'linear';
      editType: 'calc';
      values: readonly ['linear', 'exclusive', 'inclusive'];
    }
  >;
  scalegroup: Attr<
    string,
    {
      description: 'Violins 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.';
      dflt: '';
      editType: 'calc';
    }
  >;
  scalemode: Attr<
    'count' | 'width',
    {
      description: "`'width'`: the widest violin of the scale group fills its slot; `'count'`: widths are also proportional to each violin's sample count.";
      dflt: 'width';
      editType: 'calc';
      values: readonly ['width', 'count'];
    }
  >;
  selected: ObjectNode<{
    marker: ObjectNode<{
      color: Attr<
        string,
        {
          description: 'Color of selected points.' | 'Color of unselected points.';
          editType: 'style';
        }
      >;
      opacity: Attr<
        number,
        {
          description:
            | 'Opacity of unselected points. Default: 0.2 × the marker opacity.'
            | 'Opacity of selected points.';
          editType: 'style';
          max: 1;
          min: 0;
        }
      >;
    }>;
  }>;
  side: Attr<
    'both' | 'positive' | 'negative',
    {
      description: '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.';
      dflt: 'both';
      editType: 'calc';
      values: readonly ['both', 'positive', 'negative'];
    }
  >;
  span: AttrSpec<[unknown, unknown], [unknown, unknown] | undefined>;
  spanmode: Attr<
    'soft' | 'hard' | 'manual',
    {
      description: '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.';
      dflt: 'soft';
      editType: 'calc';
      values: readonly ['soft', 'hard', 'manual'];
    }
  >;
  text: Attr<
    string | readonly string[],
    {
      arrayOk: true;
      description: 'Text per sample, shown in the hover label of its point.';
      dflt: '';
      editType: 'calc';
    }
  >;
  unselected: ObjectNode<{
    marker: ObjectNode<{
      color: Attr<
        string,
        {
          description: 'Color of selected points.' | 'Color of unselected points.';
          editType: 'style';
        }
      >;
      opacity: Attr<
        number,
        {
          description:
            | 'Opacity of unselected points. Default: 0.2 × the marker opacity.'
            | 'Opacity of selected points.';
          editType: 'style';
          max: 1;
          min: 0;
        }
      >;
    }>;
  }>;
  width: Attr<
    number,
    {
      description:
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `boxgroupgap` and `boxmode`.'
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `boxgroupgap` and `violinmode`.'
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `violingroupgap` and `boxmode`.'
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `violingroupgap` and `violinmode`.'
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.violingap`, `boxgroupgap` and `boxmode`.'
        | 'Box width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.violingap`, `boxgroupgap` and `violinmode`.'
        | 'Box 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 `boxmode`.'
        | 'Box 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`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `boxgroupgap` and `boxmode`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `boxgroupgap` and `violinmode`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `violingroupgap` and `boxmode`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.boxgap`, `violingroupgap` and `violinmode`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.violingap`, `boxgroupgap` and `boxmode`.'
        | 'Violin width in position-axis units (category slots, or ms on date axes). 0 (default): computed from the spacing of the positions and `layout.violingap`, `boxgroupgap` and `violinmode`.'
        | 'Violin 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 `boxmode`.'
        | 'Violin 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`.';
      dflt: 0;
      editType: 'calc';
      min: 0;
    }
  >;
  x: AttrSpec<DataArray, DataArray | undefined>;
  x0: AttrSpec<unknown, unknown>;
  y: AttrSpec<DataArray, DataArray | undefined>;
  y0: AttrSpec<unknown, unknown>;
  zorder: Attr<
    number,
    {
      description: 'Stacking 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.';
      dflt: 0;
      editType: 'plot';
    }
  >;
}>;

Experimental

The violin schema. Common trace attributes (name, opacity, hovertemplate, …) come from core.

Released under the MIT License.