Differences from numpy and others
numpy
The rules, the edges and the counts follow numpy.histogram and numpy.histogram_bin_edges (numpy 2.5). The test suite compares this plugin with numpy's own output on 27 datasets, for the seven rules and for fixed counts, and on weighted data. Edges agree within 10⁻¹² of the largest edge, and counts agree exactly. The cases below differ on purpose.
| Case | numpy | This plugin | Why |
|---|---|---|---|
| All values equal, with a fixed count | Spreads the bins over [v − 0.5, v + 0.5] | One bin of width 1 centered on the value | Several empty bins around one value add nothing |
doane on fewer than 3 values | One bin | Falls back to sturges | The skewness of 1 or 2 values is not defined |
fd when the interquartile range is 0 | One bin | Falls back to sturges | One bin hides all the data |
| A rule with weights | Refuses: "Automated estimation of the number of bins is not supported for weighted data" | Chooses the count from the values, without their weights | A chart should draw something |
NaN, Infinity or non-numbers in the data | Raises an error | Leaves them out and counts them in dropped | Real data has gaps |
| Inner edges | start + i × step, as computed | Rounded to 14 significant digits when the difference is only rounding noise: 0.3, not 0.30000000000000004 | Readable tooltips and ticks; the change is below 4 units in the last place |
| Negative weights | Accepted | Left out with invalid-weights | They would draw bars below the axis and break densities |
With weights, numpy adds the weights in another order, so counts agree within 10⁻¹² of the total weight rather than exactly.
Coming from Highcharts
| Highcharts | This plugin |
|---|---|
binsNumber: 'square-root', 'sturges', 'rice' | bins with the same names |
binsNumber: 10 | bins: 10 |
binWidth | binWidth |
baseSeries | source |
A column series with pointPadding: 0 for pre-counted bins | parsing: false with {x0, x1, y} records |
The default rule differs: Highcharts uses 'square-root'; this plugin uses 'auto'.
Coming from Plotly
| Plotly | This plugin |
|---|---|
nbinsx | bins (Plotly treats it as a maximum; here it is the count) |
xbins: {start, end, size} | binStart, domain and binWidth |
histnorm: 'percent' | stat: 'percent' |
histnorm: 'probability' | stat: 'relative' |
histnorm: 'probability density' | stat: 'density' |
cumulative: {enabled: true, direction: 'decreasing'} | cumulative: 'reverse' |
bingroup | binGroup |