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

Skip to content

Update hist() docstring following removal of normed kwarg. #14604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 17 additions & 25 deletions lib/matplotlib/axes/_axes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6324,7 +6324,7 @@ def clabel(self, CS, *args, **kwargs):
#### Data analysis

@_preprocess_data(replace_names=["x", 'weights'], label_namer="x")
def hist(self, x, bins=None, range=None, density=None, weights=None,
def hist(self, x, bins=None, range=None, density=False, weights=None,
cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False,
color=None, label=None, stacked=False, **kwargs):
Expand Down Expand Up @@ -6396,11 +6396,7 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,
number of observations. If *stacked* is also ``True``, the sum of
the histograms is normalized to 1.

Default is ``None`` for both *normed* and *density*. If either is
set, then that value will be used. If neither are set, then the
args will be treated as ``False``.

If both *density* and *normed* are set an error is raised.
Default is ``False``.

weights : (n, ) array_like or None, optional
An array of weights, of the same shape as *x*. Each value in *x*
Expand All @@ -6420,15 +6416,18 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,

(or you may alternatively use `~.bar()`).

cumulative : bool, optional
cumulative : bool or -1, optional
If ``True``, then a histogram is computed where each bin gives the
counts in that bin plus all bins for smaller values. The last bin
gives the total number of datapoints. If *normed* or *density*
is also ``True`` then the histogram is normalized such that the
last bin equals 1. If *cumulative* evaluates to less than 0
(e.g., -1), the direction of accumulation is reversed.
In this case, if *normed* and/or *density* is also ``True``, then
the histogram is normalized such that the first bin equals 1.
gives the total number of datapoints.

If *density* is also ``True`` then the histogram is normalized such
that the last bin equals 1.

If *cumulative* is a number less than 0 (e.g., -1), the direction
of accumulation is reversed. In this case, if *density* is also
``True``, then the histogram is normalized such that the first bin
equals 1.

Default is ``False``

Expand All @@ -6445,26 +6444,19 @@ def hist(self, x, bins=None, range=None, density=None, weights=None,

- 'bar' is a traditional bar-type histogram. If multiple data
are given the bars are arranged side by side.

- 'barstacked' is a bar-type histogram where multiple
data are stacked on top of each other.

- 'step' generates a lineplot that is by default
unfilled.

- 'stepfilled' generates a lineplot that is by default
filled.
- 'step' generates a lineplot that is by default unfilled.
- 'stepfilled' generates a lineplot that is by default filled.

Default is 'bar'

align : {'left', 'mid', 'right'}, optional
Controls how the histogram is plotted.

- 'left': bars are centered on the left bin edges.

- 'mid': bars are centered between the bin edges.

- 'right': bars are centered on the right bin edges.
- 'left': bars are centered on the left bin edges.
- 'mid': bars are centered between the bin edges.
- 'right': bars are centered on the right bin edges.

Default is 'mid'

Expand Down
2 changes: 1 addition & 1 deletion lib/matplotlib/pyplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -2633,7 +2633,7 @@ def hexbin(
# Autogenerated by boilerplate.py. Do not edit as changes will be lost.
@docstring.copy(Axes.hist)
def hist(
x, bins=None, range=None, density=None, weights=None,
x, bins=None, range=None, density=False, weights=None,
cumulative=False, bottom=None, histtype='bar', align='mid',
orientation='vertical', rwidth=None, log=False, color=None,
label=None, stacked=False, *, data=None, **kwargs):
Expand Down