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

Skip to content

Commit 7b430a1

Browse files
committed
improve docstrings of pyplot.xlim and pyplot.ylim
1 parent 6601957 commit 7b430a1

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

lib/matplotlib/pyplot.py

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1541,24 +1541,31 @@ 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 alternatively pass *xmin* or *xmax* as
1553+
kwargs, i.e.::
15541554
1555-
xlim(xmax=3) # adjust the max leaving min unchanged
1556-
xlim(xmin=1) # adjust the min leaving max unchanged
1555+
xlim(xmax=3) # adjust the max leaving min unchanged
1556+
xlim(xmin=1) # adjust the min leaving max unchanged
15571557
15581558
Setting limits turns autoscaling off for the x-axis.
15591559
1560-
The new axis limits are returned as a length 2 tuple.
1560+
Returns
1561+
-------
1562+
xmin, xmax
1563+
A tuple of the new x-axis limits.
15611564
1565+
Notes
1566+
-----
1567+
This is just a shortcut for calling `~.Axes.get_xlim` or `~.Axes.set_xlim`
1568+
on the current axes. All parameters are passed to the latter.
15621569
"""
15631570
ax = gca()
15641571
if not args and not kwargs:
@@ -1569,23 +1576,31 @@ def xlim(*args, **kwargs):
15691576

15701577
def ylim(*args, **kwargs):
15711578
"""
1572-
Get or set the *y*-limits of the current axes.
1579+
Get or set the y-limits of the current axes.
15731580
1574-
::
1581+
Call signatures::
15751582
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
1583+
ymin, ymax = ylim() # return the current ylim
1584+
ylim((ymin, ymax)) # set the ylim to ymin, ymax
1585+
ylim(ymin, ymax) # set the ylim to ymin, ymax
15791586
1580-
If you do not specify args, you can pass the *ymin* and *ymax* as
1581-
kwargs, e.g.::
1587+
If you do not specify args, you can alternatively pass *ymin* or *ymax* as
1588+
kwargs, i.e.::
15821589
1583-
ylim(ymax=3) # adjust the max leaving min unchanged
1584-
ylim(ymin=1) # adjust the min leaving max unchanged
1590+
ylim(ymax=3) # adjust the max leaving min unchanged
1591+
ylim(ymin=1) # adjust the min leaving max unchanged
15851592
15861593
Setting limits turns autoscaling off for the y-axis.
15871594
1588-
The new axis limits are returned as a length 2 tuple.
1595+
Returns
1596+
-------
1597+
ymin, ymax
1598+
A tuple of the new y-axis limits.
1599+
1600+
Notes
1601+
-----
1602+
This is just a shortcut for calling `~.Axes.get_ylim` or `~.Axes.set_ylim`
1603+
on the current axes. All parameters are passed to the latter.
15891604
"""
15901605
ax = gca()
15911606
if not args and not kwargs:

0 commit comments

Comments
 (0)