Skip to content

Commit 6086c98

Browse files
authored
Merge pull request #15385 from anntzer/histdoc
Reword hist() doc.
2 parents 45b9201 + 65feb41 commit 6086c98

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

lib/matplotlib/axes/_axes.py

+14-16
Original file line numberDiff line numberDiff line change
@@ -6354,7 +6354,10 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
63546354
a 2-D ndarray in which each column is a dataset. Note that
63556355
the ndarray form is transposed relative to the list form.
63566356
6357-
Masked arrays are not supported at present.
6357+
Masked arrays are not supported.
6358+
6359+
The *bins*, *range*, *weights*, and *density* parameters behave as in
6360+
`numpy.histogram`.
63586361
63596362
Parameters
63606363
----------
@@ -6363,30 +6366,25 @@ def hist(self, x, bins=None, range=None, density=False, weights=None,
63636366
arrays which are not required to be of the same length.
63646367
63656368
bins : int or sequence or str, optional
6366-
If an integer is given, ``bins + 1`` bin edges are calculated and
6367-
returned, consistent with `numpy.histogram`.
6368-
6369-
If *bins* is a sequence, gives bin edges, including left edge of
6370-
first bin and right edge of last bin. In this case, *bins* is
6371-
returned unmodified.
6369+
If *bins* is an integer, it defines the number of equal-width bins
6370+
in the range.
63726371
6373-
All but the last (righthand-most) bin is half-open. In other
6374-
words, if *bins* is::
6372+
If *bins* is a sequence, it defines the bin edges, including the
6373+
left edge of the first bin and the right edge of the last bin;
6374+
in this case, bins may be unequally spaced. All but the last
6375+
(righthand-most) bin is half-open. In other words, if *bins* is::
63756376
63766377
[1, 2, 3, 4]
63776378
63786379
then the first bin is ``[1, 2)`` (including 1, but excluding 2) and
63796380
the second ``[2, 3)``. The last bin, however, is ``[3, 4]``, which
63806381
*includes* 4.
63816382
6382-
Unequally spaced bins are supported if *bins* is a sequence.
6383-
6384-
With Numpy 1.11 or newer, you can alternatively provide a string
6385-
describing a binning strategy, such as 'auto', 'sturges', 'fd',
6386-
'doane', 'scott', 'rice' or 'sqrt', see
6387-
`numpy.histogram`.
6383+
If *bins* is a string, it is one of the binning strategies
6384+
supported by `numpy.histogram_bin_edges`: 'auto', 'fd', 'doane',
6385+
'scott', 'stone', 'rice', 'sturges', or 'sqrt'.
63886386
6389-
The default is taken from :rc:`hist.bins`.
6387+
The default is :rc:`hist.bins`.
63906388
63916389
range : tuple or None, optional
63926390
The lower and upper range of the bins. Lower and upper outliers

0 commit comments

Comments
 (0)