<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@essex/toolbox](./toolbox.md) &gt; [histogram](./toolbox.histogram.md)

## histogram variable

Creates a histogram from an array of objects. The histogram will be populated with numeric values. If your input data is not numeric, supply an accessor function. By default, a standard equal-interval histogram will be created. If the quantize parameter is set, it will instead use quantiles (i.e., equal-length bins). If you are quantizing, you can also set a smooth parameter to indicate that breaks in the data should try to minimize variance.

Note on quantiles: the bin count and length are ideals, but not guaranteed. The way the quantiles are calculated, a precise number of bins can't be guaranteed unless you will accept empty bins. For example, if your dataset is \[1,1,1,1,1,2,2\], you will always only get back two bins. Depending on the data distribution, we also may not be able to assure each bin is the same length as the others. Using the same example dataset, here we would have one bin with 5 items, and the other with 2. We \_could\_ split them evenly and put some of the 1s in the 2 bin, but that seems less preferable.

<b>Signature:</b>

```typescript
histogram: (data: any[], bins: number, accessor?: (d: any) => any, quantize?: boolean, smooth?: boolean) => Histogram
```
