@@ -363,7 +363,7 @@ fit(::Type{Histogram{T}}, vs::NTuple{N,AbstractVector}, wv::AbstractWeights; clo
363
363
fit (Histogram{T}, vs, wv, histrange (vs,_nbins_tuple (vs, nbins),closed); closed= closed)
364
364
365
365
"""
366
- fit(Histogram, data[, weight][, edges]; closed=:left, nbins)
366
+ fit(Histogram, data[, weight][, edges]; closed=:left[ , nbins] )
367
367
368
368
Fit a histogram to `data`.
369
369
@@ -377,8 +377,12 @@ Fit a histogram to `data`.
377
377
bin. If no weight vector is supplied, each observation has weight 1.
378
378
379
379
* `edges`: a vector (typically an `AbstractRange` object), or tuple of vectors, that gives
380
- the edges of the bins along each dimension. If no edges are provided, these
381
- are determined from the data.
380
+ the edges of the bins along each dimension. If no edges are provided, they are chosen
381
+ so that approximately `nbins` bins of equal width are constructed along each dimension.
382
+
383
+ !!! note
384
+ In most cases, the number of bins will be `nbins`. However, to ensure that the bins have
385
+ equal width, more or fewer than `nbins` bins may be used.
382
386
383
387
# Keyword arguments
384
388
@@ -387,6 +391,8 @@ Fit a histogram to `data`.
387
391
388
392
* `nbins`: if no `edges` argument is supplied, the approximate number of bins to use
389
393
along each dimension (can be either a single integer, or a tuple of integers).
394
+ If omitted, it is computed using Sturges's formula, i.e. `ceil(log2(length(n))) + 1`
395
+ with `n` the number of data points.
390
396
391
397
# Examples
392
398
0 commit comments