Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8ac3ea1

Browse files
authored
Merge pull request #16572 from anntzer/unnormed
Remove some remnants of hist{,2d}(normed=...).
2 parents dc1f0d9 + 831157a commit 8ac3ea1

File tree

2 files changed

+18
-18
lines changed

2 files changed

+18
-18
lines changed

examples/statistics/histogram_features.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
"""
2-
=========================================================
3-
Demo of the histogram (hist) function with a few features
4-
=========================================================
2+
==============================================
3+
Some features of the histogram (hist) function
4+
==============================================
55
66
In addition to the basic histogram, this demo shows a few optional features:
77
88
* Setting the number of data bins.
9-
* The ``normed`` flag, which normalizes bin heights so that the integral of
9+
* The *density* parameter, which normalizes bin heights so that the integral of
1010
the histogram is 1. The resulting histogram is an approximation of the
1111
probability density function.
1212
* Setting the face color of the bars.

lib/matplotlib/axes/_axes.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6476,22 +6476,22 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
64766476
range of x.
64776477
64786478
density : bool, default: False
6479-
If ``True``, the first element of the return tuple will
6480-
be the raw counts per bin normalized to form a probability density
6481-
so that the area under the histogram will integrate to 1, i.e.
6482-
``np.sum(n * np.diff(bins)) == 1``. (Computed by dividing the
6483-
raw counts ``n0`` by the total number of data points and
6484-
multiplying by the bin width: ``n = n0 / sum(n0) * np.diff(bins)``)
6479+
If ``True``, draw and return a probability density: each bin
6480+
will display the bin's raw count divided by the total number of
6481+
counts *and the bin width*
6482+
(``density = counts / (sum(counts) * np.diff(bins))``),
6483+
so that the area under the histogram integrates to 1
6484+
(``np.sum(density * np.diff(bins)) == 1``).
64856485
64866486
If *stacked* is also ``True``, the sum of the histograms is
64876487
normalized to 1.
64886488
64896489
weights : (n,) array-like or None, default: None
6490-
An array of weights, of the same shape as *x*. Each value in *x*
6491-
only contributes its associated weight towards the bin count
6492-
(instead of 1). If *normed* or *density* is ``True``,
6493-
the weights are normalized, so that the integral of the density
6494-
over the range remains 1.
6490+
An array of weights, of the same shape as *x*. Each value in
6491+
*x* only contributes its associated weight towards the bin count
6492+
(instead of 1). If *density* is ``True``, the weights are
6493+
normalized, so that the integral of the density over the range
6494+
remains 1.
64956495
64966496
This parameter can be used to draw a histogram of data that has
64976497
already been binned, e.g. using `numpy.histogram` (by treating each
@@ -6916,8 +6916,8 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
69166916
considered outliers and not tallied in the histogram.
69176917
69186918
density : bool, default: False
6919-
Normalize histogram. *normed* is a deprecated synonym for this
6920-
parameter.
6919+
Normalize histogram. See the documentation for the *density*
6920+
parameter of `~.Axes.hist` for more details.
69216921
69226922
weights : array-like, shape (n, ), optional
69236923
An array of values w_i weighing each sample (x_i, y_i).
@@ -6976,7 +6976,7 @@ def hist2d(self, x, y, bins=10, range=None, density=False, weights=None,
69766976
"""
69776977

69786978
h, xedges, yedges = np.histogram2d(x, y, bins=bins, range=range,
6979-
normed=density, weights=weights)
6979+
density=density, weights=weights)
69806980

69816981
if cmin is not None:
69826982
h[h < cmin] = None

0 commit comments

Comments
 (0)