r""" Function to calculate only the edges of the bins used by the `histogram` function. Parameters ---------- a : array_like Input data. The histogram is computed over the flattened array. bins : int or sequence of scalars or str, optional If `bins` is an int
(a, bins=10, range=None, weights=None)
| 472 | |
| 473 | @array_function_dispatch(_histogram_bin_edges_dispatcher) |
| 474 | def histogram_bin_edges(a, bins=10, range=None, weights=None): |
| 475 | r""" |
| 476 | Function to calculate only the edges of the bins used by the `histogram` |
| 477 | function. |
| 478 | |
| 479 | Parameters |
| 480 | ---------- |
| 481 | a : array_like |
| 482 | Input data. The histogram is computed over the flattened array. |
| 483 | bins : int or sequence of scalars or str, optional |
| 484 | If `bins` is an int, it defines the number of equal-width |
| 485 | bins in the given range (10, by default). If `bins` is a |
| 486 | sequence, it defines the bin edges, including the rightmost |
| 487 | edge, allowing for non-uniform bin widths. |
| 488 | |
| 489 | If `bins` is a string from the list below, `histogram_bin_edges` will |
| 490 | use the method chosen to calculate the optimal bin width and |
| 491 | consequently the number of bins (see the Notes section for more detail |
| 492 | on the estimators) from the data that falls within the requested range. |
| 493 | While the bin width will be optimal for the actual data |
| 494 | in the range, the number of bins will be computed to fill the |
| 495 | entire range, including the empty portions. For visualisation, |
| 496 | using the 'auto' option is suggested. Weighted data is not |
| 497 | supported for automated bin size selection. |
| 498 | |
| 499 | 'auto' |
| 500 | Minimum bin width between the 'sturges' and 'fd' estimators. |
| 501 | Provides good all-around performance. |
| 502 | |
| 503 | 'fd' (Freedman Diaconis Estimator) |
| 504 | Robust (resilient to outliers) estimator that takes into |
| 505 | account data variability and data size. |
| 506 | |
| 507 | 'doane' |
| 508 | An improved version of Sturges' estimator that works better |
| 509 | with non-normal datasets. |
| 510 | |
| 511 | 'scott' |
| 512 | Less robust estimator that takes into account data variability |
| 513 | and data size. |
| 514 | |
| 515 | 'stone' |
| 516 | Estimator based on leave-one-out cross-validation estimate of |
| 517 | the integrated squared error. Can be regarded as a generalization |
| 518 | of Scott's rule. |
| 519 | |
| 520 | 'rice' |
| 521 | Estimator does not take variability into account, only data |
| 522 | size. Commonly overestimates number of bins required. |
| 523 | |
| 524 | 'sturges' |
| 525 | R's default method, only accounts for data size. Only |
| 526 | optimal for gaussian data and underestimates number of bins |
| 527 | for large non-gaussian datasets. |
| 528 | |
| 529 | 'sqrt' |
| 530 | Square root (of data size) estimator, used by Excel and |
| 531 | other programs for its speed and simplicity. |
searching dependent graphs…