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

Skip to content

Commit 4c23c38

Browse files
committed
MEP10 - refactored hlines and vlines documentation
1 parent f5d86b1 commit 4c23c38

File tree

1 file changed

+43
-40
lines changed

1 file changed

+43
-40
lines changed

lib/matplotlib/axes.py

Lines changed: 43 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -3656,37 +3656,36 @@ def hlines(self, y, xmin, xmax, colors='k', linestyles='solid',
36563656
"""
36573657
Plot horizontal lines.
36583658
3659-
call signature::
3660-
3661-
hlines(y, xmin, xmax, colors='k', linestyles='solid', **kwargs)
3662-
3663-
Plot horizontal lines at each *y* from *xmin* to *xmax*.
3664-
3665-
Returns the :class:`~matplotlib.collections.LineCollection`
3666-
that was added.
3667-
3668-
Required arguments:
3659+
Plot horizontal lines at each `y` from `xmin` to `xmax`.
36693660
3670-
*y*:
3671-
a 1-D numpy array or iterable.
3661+
Parameters
3662+
----------
3663+
y : scalar or 1D array like
3664+
y-indexes where to plot the lines.
36723665
3673-
*xmin* and *xmax*:
3674-
can be scalars or ``len(x)`` numpy arrays. If they are
3675-
scalars, then the respective values are constant, else the
3676-
widths of the lines are determined by *xmin* and *xmax*.
3666+
xmin, xmax : scalar or 1D array like
3667+
Respective beginning and end of each line. If scalars are
3668+
provided, all lines will have same length.
36773669
3678-
Optional keyword arguments:
3670+
colors : a line collections color argument, either a single color
3671+
or a list of colors
36793672
3680-
*colors*:
3681-
a line collections color argument, either a single color
3682-
or a ``len(y)`` list of colors
3673+
linestyles : ['solid' | 'dashed' | 'dashdot' | 'dotted'], optional,
3674+
default : 'solid'
36833675
3684-
*linestyles*:
3685-
[ 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
3676+
label : string, optional, default: ''
36863677
3687-
**Example:**
3678+
Returns
3679+
-------
3680+
:class:`~matplotlib.collections.LineCollection`
36883681
3682+
Example
3683+
--------
36893684
.. plot:: mpl_examples/pylab_examples/hline_demo.py
3685+
3686+
See also
3687+
--------
3688+
vlines : horizontal lines
36903689
"""
36913690

36923691
# We do the conversion first since not all unitized data is uniform
@@ -3743,27 +3742,33 @@ def vlines(self, x, ymin, ymax, colors='k', linestyles='solid',
37433742
"""
37443743
Plot vertical lines.
37453744
3746-
Call signature::
3745+
Plot vertical lines at each `x` from `ymin` to `ymax`.
37473746
3748-
vlines(x, ymin, ymax, color='k', linestyles='solid')
3747+
Parameters
3748+
----------
3749+
x : scalar or 1D array like
3750+
x-indexes where to plot the lines.
37493751
3750-
Plot vertical lines at each *x* from *ymin* to *ymax*. *ymin*
3751-
or *ymax* can be scalars or len(*x*) numpy arrays. If they are
3752-
scalars, then the respective values are constant, else the
3753-
heights of the lines are determined by *ymin* and *ymax*.
3752+
xmin, xmax : scalar or 1D array like
3753+
Respective beginning and end of each line. If scalars are
3754+
provided, all lines will have same length.
37543755
3755-
*colors* :
3756-
A line collection's color args, either a single color
3757-
or a ``len(x)`` list of colors
3756+
colors : a line collections color argument, either a single color
3757+
or a list of colors
37583758
3759-
*linestyles* : [ 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
3759+
linestyles : ['solid' | 'dashed' | 'dashdot' | 'dotted'], optional,
3760+
default : 'solid'
37603761
3761-
Returns the :class:`matplotlib.collections.LineCollection`
3762-
that was added.
3762+
label : string, optional, default: ''
37633763
3764-
kwargs are :class:`~matplotlib.collections.LineCollection` properties:
3764+
Returns
3765+
-------
3766+
:class:`~matplotlib.collections.LineCollection`
3767+
3768+
See also
3769+
--------
3770+
hlines : horizontal lines
37653771
3766-
%(LineCollection)s
37673772
"""
37683773

37693774
self._process_unit_info(xdata=x, ydata=[ymin, ymax], kwargs=kwargs)
@@ -8322,8 +8327,6 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
83228327
mlast[:] = m
83238328
n.append(m)
83248329

8325-
8326-
83278330
if cumulative:
83288331
slc = slice(None)
83298332
if cbook.is_numlike(cumulative) and cumulative < 0:
@@ -8405,7 +8408,7 @@ def hist(self, x, bins=10, range=None, normed=False, weights=None,
84058408
# For normed data, set to log base * minimum data value
84068409
# (gives 1 full tick-label unit for the lowest filled bin)
84078410
ndata = np.array(n)
8408-
minimum = (np.min(ndata[ndata>0])) / logbase
8411+
minimum = (np.min(ndata[ndata > 0])) / logbase
84098412
else:
84108413
# For non-normed data, set the min to log base, again so
84118414
# that there is 1 full tick-label unit for the lowest bin

0 commit comments

Comments
 (0)