Skip to content

Type Alias: BoxTrace ​

ts
type BoxTrace = CommonTraceAttributes & CartesianTraceAttributes & object;

Box plot: quartiles, median, whiskers and outliers of samples (or of precomputed statistics) at each position.

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.
boxmean?true | "sd" | falseDraw the mean as a dashed line (true), plus a dashed diamond spanning ± sdmultiple standard deviations ('sd'). Default: on with precomputed mean (and 'sd' with sd).
boxpoints?"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, the whiskers then reach the extreme samples). Default: 'suspectedoutliers' when an outlier color is set, 'all' with precomputed statistics, else 'outliers'.
dx?numberStep between the positions of precomputed boxes when x is not given: box i is at x0 + i·dx. Default 1.
dy?numberStep between the positions of precomputed horizontal boxes when y is not given. Default 1.
fillcolor?stringFill color of the box. Default: line.color at half opacity.
hoveron?"boxes" | "points" | "boxes+points" | "points+boxes"What shows hover labels: the boxes (one label per statistic, as Plotly), the points, or both (a point under the pointer wins).
jitter?numberRandom 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). Range: 0 – 1
line?BoxTraceLineOutline of the box.
lowerfence?DataColumnPrecomputed lower whisker ends, one per box. Default: the lowest sample within 1.5 IQR of q1 when samples are given, else q1.
marker?BoxTraceMarkerStyle of the sample points.
mean?DataColumnPrecomputed means, one per box (turns boxmean on by default). Default: the sample mean, else (q1 + q3) / 2.
median?DataColumnPrecomputed medians, one per box.
notched?booleanDraw notches at the median's 95% confidence interval (median ± 1.57 · IQR / √n): boxes whose notches don't overlap have different medians with roughly 95% confidence. Default: true when notchwidth (or notchspan) is set.
notchspan?DataColumnPrecomputed notch half-heights, one per box (turns notched on by default). Default: 1.57 · IQR / √n.
notchwidth?numberHow far notches cut into the box, as a fraction of its width (0–0.5). Range: 0 – 0.5
offsetgroup?stringWith layout.boxmode: '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 boxes 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 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. Range: -2 – 2
q1?DataColumnPrecomputed first quartiles, one per box. With median and q3, switches the trace to precomputed statistics.
q3?DataColumnPrecomputed third quartiles, one per box.
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.
sd?DataColumnPrecomputed standard deviations, one per box (with mean, makes boxmean: 'sd' the default). Default: the sample standard deviation, else q3 − q1.
sdmultiple?numberHow many standard deviations the sizemode: 'sd' box and the boxmean: 'sd' diamond span on each side of the mean. Minimum: 0
selected?BoxTraceSelectedStyle of selected points while a selection is active.
showwhiskers?booleanDraw the whiskers. Default: true, except with sizemode: 'sd'.
sizemode?"quartiles" | "sd"'quartiles': the box spans q1–q3 with a line at the median; 'sd': it spans mean ± sdmultiple standard deviations with a line at the mean (no whiskers by default).
text?PerPoint<string | number>Text per sample, shown in the hover label of its point.
type"box"Trace type.
unselected?BoxTraceUnselectedStyle of unselected points while a selection is active.
upperfence?DataColumnPrecomputed upper whisker ends, one per box. Default: the highest sample within 1.5 IQR of q3 when samples are given, else q3.
whiskerwidth?numberWidth of the whisker caps as a fraction of the box width (0: no caps). Range: 0 – 1
width?numberBox 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. Minimum: 0
x?DataColumnx samples: the values of horizontal boxes when y is not given, else the position of each sample (one box per distinct x) for vertical boxes. With precomputed statistics (q1, median, q3): the position of each box, or one sample array per box on the value axis.
x0?unknownPosition of the box 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 box's index among the box traces.
y?DataColumny samples: the values of horizontal boxes when x is not given, else the position of each sample (one box per distinct y) for vertical boxes. With precomputed statistics (q1, median, q3): the position of each box, or one sample array per box on the value axis.
y0?unknownPosition of the box 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 box's index among the box 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.