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

Skip to content

Commit 54e8a3d

Browse files
timhoffmMeeseeksDev[bot]
authored andcommitted
Backport PR matplotlib#14604: Update hist() docstring following removal of normed kwarg.
1 parent 9a5473d commit 54e8a3d

File tree

2 files changed

+18
-26
lines changed

2 files changed

+18
-26
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 17 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6431,7 +6431,7 @@ def clabel(self, CS, *args, **kwargs):
64316431
#### Data analysis
64326432

64336433
@_preprocess_data(replace_names=["x", 'weights'], label_namer="x")
6434-
def hist(self, x, bins=None, range=None, density=None, weights=None,
6434+
def hist(self, x, bins=None, range=None, density=False, weights=None,
64356435
cumulative=False, bottom=None, histtype='bar', align='mid',
64366436
orientation='vertical', rwidth=None, log=False,
64376437
color=None, label=None, stacked=False, normed=None,
@@ -6504,11 +6504,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65046504
number of observations. If *stacked* is also ``True``, the sum of
65056505
the histograms is normalized to 1.
65066506
6507-
Default is ``None`` for both *normed* and *density*. If either is
6508-
set, then that value will be used. If neither are set, then the
6509-
args will be treated as ``False``.
6510-
6511-
If both *density* and *normed* are set an error is raised.
6507+
Default is ``False``.
65126508
65136509
weights : (n, ) array_like or None, optional
65146510
An array of weights, of the same shape as *x*. Each value in *x*
@@ -6528,15 +6524,18 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65286524
65296525
(or you may alternatively use `~.bar()`).
65306526
6531-
cumulative : bool, optional
6527+
cumulative : bool or -1, optional
65326528
If ``True``, then a histogram is computed where each bin gives the
65336529
counts in that bin plus all bins for smaller values. The last bin
6534-
gives the total number of datapoints. If *normed* or *density*
6535-
is also ``True`` then the histogram is normalized such that the
6536-
last bin equals 1. If *cumulative* evaluates to less than 0
6537-
(e.g., -1), the direction of accumulation is reversed.
6538-
In this case, if *normed* and/or *density* is also ``True``, then
6539-
the histogram is normalized such that the first bin equals 1.
6530+
gives the total number of datapoints.
6531+
6532+
If *density* is also ``True`` then the histogram is normalized such
6533+
that the last bin equals 1.
6534+
6535+
If *cumulative* is a number less than 0 (e.g., -1), the direction
6536+
of accumulation is reversed. In this case, if *density* is also
6537+
``True``, then the histogram is normalized such that the first bin
6538+
equals 1.
65406539
65416540
Default is ``False``
65426541
@@ -6553,26 +6552,19 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
65536552
65546553
- 'bar' is a traditional bar-type histogram. If multiple data
65556554
are given the bars are arranged side by side.
6556-
65576555
- 'barstacked' is a bar-type histogram where multiple
65586556
data are stacked on top of each other.
6559-
6560-
- 'step' generates a lineplot that is by default
6561-
unfilled.
6562-
6563-
- 'stepfilled' generates a lineplot that is by default
6564-
filled.
6557+
- 'step' generates a lineplot that is by default unfilled.
6558+
- 'stepfilled' generates a lineplot that is by default filled.
65656559
65666560
Default is 'bar'
65676561
65686562
align : {'left', 'mid', 'right'}, optional
65696563
Controls how the histogram is plotted.
65706564
6571-
- 'left': bars are centered on the left bin edges.
6572-
6573-
- 'mid': bars are centered between the bin edges.
6574-
6575-
- 'right': bars are centered on the right bin edges.
6565+
- 'left': bars are centered on the left bin edges.
6566+
- 'mid': bars are centered between the bin edges.
6567+
- 'right': bars are centered on the right bin edges.
65766568
65776569
Default is 'mid'
65786570

lib/matplotlib/pyplot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2629,7 +2629,7 @@ def hexbin(
26292629
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
26302630
@docstring.copy(Axes.hist)
26312631
def hist(
2632-
x, bins=None, range=None, density=None, weights=None,
2632+
x, bins=None, range=None, density=False, weights=None,
26332633
cumulative=False, bottom=None, histtype='bar', align='mid',
26342634
orientation='vertical', rwidth=None, log=False, color=None,
26352635
label=None, stacked=False, normed=None, *, data=None,

0 commit comments

Comments
 (0)