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

Skip to content

Commit 5ead4ef

Browse files
committed
improve docstrings of pyplot.xlim and pyplot.ylim
1 parent fc775f5 commit 5ead4ef

File tree

1 file changed

+38
-20
lines changed

1 file changed

+38
-20
lines changed

lib/matplotlib/pyplot.py

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,24 +1541,32 @@ def ylabel(s, *args, **kwargs):
15411541

15421542
def xlim(*args, **kwargs):
15431543
"""
1544-
Get or set the *x* limits of the current axes.
1544+
Get or set the x limits of the current axes.
15451545
1546-
::
1546+
Call signatures::
15471547
1548-
xmin, xmax = xlim() # return the current xlim
1549-
xlim( (xmin, xmax) ) # set the xlim to xmin, xmax
1550-
xlim( xmin, xmax ) # set the xlim to xmin, xmax
1548+
xmin, xmax = xlim() # return the current xlim
1549+
xlim((xmin, xmax)) # set the xlim to xmin, xmax
1550+
xlim(xmin, xmax) # set the xlim to xmin, xmax
15511551
1552-
If you do not specify args, you can pass the xmin and xmax as
1553-
kwargs, e.g.::
1552+
If you do not specify args, you can pass *xmin* or *xmax* as kwargs, i.e.::
15541553
1555-
xlim(xmax=3) # adjust the max leaving min unchanged
1556-
xlim(xmin=1) # adjust the min leaving max unchanged
1554+
xlim(xmax=3) # adjust the max leaving min unchanged
1555+
xlim(xmin=1) # adjust the min leaving max unchanged
15571556
15581557
Setting limits turns autoscaling off for the x-axis.
15591558
1560-
The new axis limits are returned as a length 2 tuple.
1559+
Returns
1560+
-------
1561+
xmin, xmax
1562+
A tuple of the new x-axis limits.
15611563
1564+
Notes
1565+
-----
1566+
Calling this function with no arguments (e.g. ``xlim()``) is the pyplot
1567+
equivalent of calling `~.Axes.get_xlim` on the current axes.
1568+
Calling this function with arguments is the pyplot equivalent of calling
1569+
`~.Axes.set_xlim` on the current axes. All arguments are passed though.
15621570
"""
15631571
ax = gca()
15641572
if not args and not kwargs:
@@ -1569,23 +1577,33 @@ def xlim(*args, **kwargs):
15691577

15701578
def ylim(*args, **kwargs):
15711579
"""
1572-
Get or set the *y*-limits of the current axes.
1580+
Get or set the y-limits of the current axes.
15731581
1574-
::
1582+
Call signatures::
15751583
1576-
ymin, ymax = ylim() # return the current ylim
1577-
ylim( (ymin, ymax) ) # set the ylim to ymin, ymax
1578-
ylim( ymin, ymax ) # set the ylim to ymin, ymax
1584+
ymin, ymax = ylim() # return the current ylim
1585+
ylim((ymin, ymax)) # set the ylim to ymin, ymax
1586+
ylim(ymin, ymax) # set the ylim to ymin, ymax
15791587
1580-
If you do not specify args, you can pass the *ymin* and *ymax* as
1581-
kwargs, e.g.::
1588+
If you do not specify args, you can alternatively pass *ymin* or *ymax* as
1589+
kwargs, i.e.::
15821590
1583-
ylim(ymax=3) # adjust the max leaving min unchanged
1584-
ylim(ymin=1) # adjust the min leaving max unchanged
1591+
ylim(ymax=3) # adjust the max leaving min unchanged
1592+
ylim(ymin=1) # adjust the min leaving max unchanged
15851593
15861594
Setting limits turns autoscaling off for the y-axis.
15871595
1588-
The new axis limits are returned as a length 2 tuple.
1596+
Returns
1597+
-------
1598+
ymin, ymax
1599+
A tuple of the new y-axis limits.
1600+
1601+
Notes
1602+
-----
1603+
Calling this function with no arguments (e.g. ``ylim()``) is the pyplot
1604+
equivalent of calling `~.Axes.get_ylim` on the current axes.
1605+
Calling this function with arguments is the pyplot equivalent of calling
1606+
`~.Axes.set_ylim` on the current axes. All arguments are passed though.
15891607
"""
15901608
ax = gca()
15911609
if not args and not kwargs:

0 commit comments

Comments
 (0)