Skip to content

Function: distplot() ​

Call Signature ​

ts
function distplot(samples, labels, options?): ExpressFigure;

A distribution plot, like plotly.py's ff.create_distplot(hist_data, group_labels): for each sample set, a histogram (histnorm: 'probability density', bins of binSize from its smallest to largest sample, opacity: 0.7), a curve (Gaussian KDE with Scott's rule, or a fitted normal) on the same axes, and a rug (line-ns-open markers) in a strip below; barmode: 'overlay', the legend in reverse order. Differences from plotly.py: colors default to the template's colorway instead of category10. With an element first, renders it and resolves with the chart.

Parameters ​

ParameterType
samplesreadonly ArrayLike<number>[]
labelsreadonly string[]
options?DistplotOptions

Returns ​

ExpressFigure

Example ​

ts
const figure = ff.distplot([a, b], ['Group A', 'Group B'], { binSize: 0.25 });

Throws ​

Without samples, with a label count that differs, and (KDE) for a set with fewer than two samples or no spread.

Call Signature ​

ts
function distplot(el, samples, labels, options?): Promise<Chart>;

A distribution plot, like plotly.py's ff.create_distplot(hist_data, group_labels): for each sample set, a histogram (histnorm: 'probability density', bins of binSize from its smallest to largest sample, opacity: 0.7), a curve (Gaussian KDE with Scott's rule, or a fitted normal) on the same axes, and a rug (line-ns-open markers) in a strip below; barmode: 'overlay', the legend in reverse order. Differences from plotly.py: colors default to the template's colorway instead of category10. With an element first, renders it and resolves with the chart.

Parameters ​

ParameterType
elHTMLElement
samplesreadonly ArrayLike<number>[]
labelsreadonly string[]
options?DistplotOptions

Returns ​

Promise<Chart>

Example ​

ts
const figure = ff.distplot([a, b], ['Group A', 'Group B'], { binSize: 0.25 });

Throws ​

Without samples, with a label count that differs, and (KDE) for a set with fewer than two samples or no spread.

Released under the MIT License.