8000 DOC : numpydoc-ified ax.hist docstring · matplotlib/matplotlib@f3da5d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit f3da5d9

Browse files
committed
DOC : numpydoc-ified ax.hist docstring
- [ .. | ..| ] -> {.., ..} - moved deault values to description body per the 'Paramters' section of https://github.com/numpy/numpy/blob/master/doc/HOWTO_DOCUMENT.rst.txt#sections - corrected some default values - added `None` to parameters where allowed
1 parent c2fff54 commit f3da5d9

File tree

1 file changed

+43
-16
lines changed

1 file changed

+43
-16
lines changed

lib/matplotlib/axes/_axes.py

Lines changed: 43 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5400,14 +5400,16 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54005400
Input values, this takes either a single array or a sequency of
54015401
arrays which are not required to be of the same length
54025402
5403-
bins : integer or array_like, optional, default: 10
5403+
bins : integer or array_like, optional
54045404
If an integer is given, `bins + 1` bin edges are returned,
54055405
consistently with :func:`numpy.histogram` for numpy version >=
54065406
1.3.
54075407
54085408
Unequally spaced bins are supported if `bins` is a sequence.
54095409
5410-
range : tuple, optional, default: None
5410+
default is 10
5411+
5412+
range : tuple or None, optional
54115413
The lower and upper range of the bins. Lower and upper outliers
54125414
are ignored. If not provided, `range` is (x.min(), x.max()). Range
54135415
has no effect if `bins` is a sequence.
@@ -5416,20 +5418,26 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54165418
is based on the specified bin range instead of the
54175419
range of x.
54185420
5419-
normed : boolean, optional, default: False
5421+
Default is ``None``
5422+
5423+
normed : boolean, optional
54205424
If `True`, the first element of the return tuple will
54215425
be the counts normalized to form a probability density, i.e.,
54225426
``n/(len(x)`dbin)``, i.e., the integral of the histogram will sum
54235427
to 1. If *stacked* is also *True*, the sum of the histograms is
54245428
normalized to 1.
54255429
5426-
weights : array_like, shape (n, ), optional, default: None
5430+
Default is ``False``
5431+
5432+
weights : (n, ) array_like or None, optional
54275433
An array of weights, of the same shape as `x`. Each value in `x`
54285434
only contributes its associated weight towards the bin count
54295435
(instead of 1). If `normed` is True, the weights are normalized,
54305436
so that the integral of the density over the range remains 1.
54315437
5432-
cumulative : boolean, optional, default : False
5438+
Default is ``None``
5439+
5440+
cumulative : boolean, optional
54335441
If `True`, then a histogram is computed where each bin gives the
54345442
counts in that bin plus all bins for smaller values. The last bin
54355443
gives the total number of datapoints. If `normed` is also `True`
@@ -5439,13 +5447,17 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54395447
`True`, then the histogram is normalized such that the first bin
54405448
equals 1.
54415449
5442-
bottom : array_like, scalar, or None, default: None
5450+
Default is ``False``
5451+
5452+
bottom : array_like, scalar, or None
54435453
Location of the bottom baseline of each bin. If a scalar,
54445454
the base line for each bin is shifted by the same amount.
54455455
If an array, each bin is shifted independently and the length
54465456
of bottom must match the number of bins. If None, defaults to 0.
54475457
5448-
histtype : ['bar' | 'barstacked' | 'step' | 'stepfilled'], optional
5458+
Default is ``None``
5459+
5460+
histtype : {'bar', 'barstacked', 'step', 'stepfilled'}, optional
54495461
The type of histogram to draw.
54505462
54515463
- 'bar' is a traditional bar-type histogram. If multiple data
@@ -5460,7 +5472,9 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54605472
- 'stepfilled' generates a lineplot that is by default
54615473
filled.
54625474
5463-
align : ['left' | 'mid' | 'right'], optional, default: 'mid'
5475+
Default is 'bar'
5476+
5477+
align : {'left', 'mid', 'right'}, optional
54645478
Controls how the histogram is plotted.
54655479
54665480
- 'left': bars are centered on the left bin edges.
@@ -5469,34 +5483,47 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
54695483
54705484
- 'right': bars are centered on the right bin edges.
54715485
5472-
orientation : ['horizontal' | 'vertical'], optional
5486+
Default is 'mid'
5487+
5488+
orientation : {'horizontal', 'vertical'}, optional
54735489
If 'horizontal', `~matplotlib.pyplot.barh` will be used for
54745490
bar-type histograms and the *bottom* kwarg will be the left edges.
54755491
5476-
rwidth : scalar, optional, default: None
5492+
rwidth : scalar or None, optional
54775493
The relative width of the bars as a fraction of the bin width. If
5478-
`None`, automatically compute the width. Ignored if `histtype` =
5479-
'step' or 'stepfilled'.
5494+
`None`, automatically compute the width.
5495+
5496+
Ignored if `histtype` is 'step' or 'stepfilled'.
54805497
5481-
log : boolean, optional, default : False
5498+
Default is ``None``
5499+
5500+
log : boolean, optional
54825501
If `True`, the histogram axis will be set to a log scale. If `log`
54835502
is `True` and `x` is a 1D array, empty bins will be filtered out
54845503
and only the non-empty (`n`, `bins`, `patches`) will be returned.
54855504
5486-
color : color or array_like of colors, optional, default: None
5505+
Default is ``False``
5506+
5507+
color : color or array_like of colors or None, optional
54875508
Color spec or sequence of color specs, one per dataset. Default
54885509
(`None`) uses the standard line color sequence.
54895510
5490-
label : string, optional, default: ''
5511+
Default is ``None``
5512+
5513+
label : string or None, optional
54915514
String, or sequence of strings to match multiple datasets. Bar
54925515
charts yield multiple patches per dataset, but only the first gets
54935516
the label, so that the legend command will work as expected.
54945517
5495-
stacked : boolean, optional, default : False
5518+
default is ``None``
5519+
5520+
stacked : boolean, optional
54965521
If `True`, multiple data are stacked on top of each other If
54975522
`False` multiple data are aranged side by side if histtype is
54985523
'bar' or on top of each other if histtype is 'step'
54995524
5525+
Default is ``False``
5526+
55005527
Returns
55015528
-------
55025529
n : array or list of arrays

0 commit comments

Comments
 (0)
0