diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-07-08 15:47:00 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-08 15:47:00 -0600 |
commit | d89bc4bbf541affbcf87498ff4af86b9451480cd (patch) | |
tree | 0e5abbb2b4c7448ced954a782c64be82f16d4561 /numpy/lib/twodim_base.py | |
parent | a56c4e6251d6e607759788727ede2fe2f10a417b (diff) | |
parent | 8ea9e8bf13e4292d02e9ea5af2f4d10c07e02459 (diff) | |
download | numpy-d89bc4bbf541affbcf87498ff4af86b9451480cd.tar.gz |
Merge pull request #11531 from eric-wieser/histogramdd-density-no-deprecation
ENH: Add density argument to histogramdd.
Diffstat (limited to 'numpy/lib/twodim_base.py')
-rw-r--r-- | numpy/lib/twodim_base.py | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index cca316e9a..98efba191 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -530,7 +530,8 @@ def vander(x, N=None, increasing=False): return v -def histogram2d(x, y, bins=10, range=None, normed=False, weights=None): +def histogram2d(x, y, bins=10, range=None, normed=None, weights=None, + density=None): """ Compute the bi-dimensional histogram of two data samples. @@ -560,9 +561,14 @@ def histogram2d(x, y, bins=10, range=None, normed=False, weights=None): (if not specified explicitly in the `bins` parameters): ``[[xmin, xmax], [ymin, ymax]]``. All values outside of this range will be considered outliers and not tallied in the histogram. + density : bool, optional + If False, the default, returns the number of samples in each bin. + If True, returns the probability *density* function at the bin, + ``bin_count / sample_count / bin_area``. normed : bool, optional - If False, returns the number of samples in each bin. If True, - returns the bin density ``bin_count / sample_count / bin_area``. + An alias for the density argument that behaves identically. To avoid + confusion with the broken normed argument to `histogram`, `density` + should be preferred. weights : array_like, shape(N,), optional An array of values ``w_i`` weighing each sample ``(x_i, y_i)``. Weights are normalized to 1 if `normed` is True. If `normed` is @@ -652,7 +658,7 @@ def histogram2d(x, y, bins=10, range=None, normed=False, weights=None): if N != 1 and N != 2: xedges = yedges = asarray(bins) bins = [xedges, yedges] - hist, edges = histogramdd([x, y], bins, range, normed, weights) + hist, edges = histogramdd([x, y], bins, range, normed, weights, density) return hist, edges[0], edges[1] |