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

Skip to content

Commit a2b990d

Browse files
committed
Convert docstring for set_xlim(), per issue #7205
Convert set_xlim() docstring to numpydoc format.
1 parent 5ac0881 commit a2b990d

1 file changed

Lines changed: 40 additions & 25 deletions

File tree

lib/matplotlib/axes/_base.py

Lines changed: 40 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2789,43 +2789,58 @@ def get_xlim(self):
27892789

27902790
def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
27912791
"""
2792-
Set the data limits for the xaxis
2792+
Set the data limits for the x-axis
27932793
2794-
Examples::
2794+
Parameters
2795+
----------
2796+
left : scalar, optional
2797+
The left xlim (default: None, which leaves the left limit
2798+
unchanged). The previous name `xmin` may be used instead.
27952799
2796-
set_xlim((left, right))
2797-
set_xlim(left, right)
2798-
set_xlim(left=1) # right unchanged
2799-
set_xlim(right=1) # left unchanged
2800+
right : scalar, optional
2801+
The right xlim (default: None, which leaves the right limit
2802+
unchanged). The previous name `xmax` may be used instead.
28002803
2801-
Keyword arguments:
2804+
emit : bool, optional
2805+
Whether to notify observers of limit change (default: True).
28022806
2803-
*left*: scalar
2804-
The left xlim; *xmin*, the previous name, may still be used
2807+
auto : {True, False, None}, optional
2808+
Whether to turn on autoscaling of the x-axis. True turns on,
2809+
False turns off (default action), None leaves unchanged.
28052810
2806-
*right*: scalar
2807-
The right xlim; *xmax*, the previous name, may still be used
2811+
xlimits : tuple, optional
2812+
The left and right xlims may be passed as the tuple
2813+
(`left`, `right`) as the first positional argument (or as
2814+
the `left` keyword argument).
28082815
2809-
*emit*: [ *True* | *False* ]
2810-
Notify observers of limit change
2816+
Returns
2817+
-------
2818+
xlimits : tuple
2819+
Returns the current x-axis limits, reflecting any changes
2820+
made by this call, as (`left`, `right`).
28112821
2812-
*auto*: [ *True* | *False* | *None* ]
2813-
Turn *x* autoscaling on (*True*), off (*False*; default),
2814-
or leave unchanged (*None*)
2822+
Notes
2823+
-----
2824+
The `left` value may be greater than the `right` value, in which
2825+
case the x-axis values will decrease from left to right.
28152826
2816-
Note, the *left* (formerly *xmin*) value may be greater than
2817-
the *right* (formerly *xmax*).
2818-
For example, suppose *x* is years before present.
2819-
Then one might use::
2827+
Examples
2828+
--------
2829+
>>> set_xlim(left, right)
2830+
>>> set_xlim((left, right))
2831+
>>> left, right = set_xlim(left, right)
28202832
2821-
set_xlim(5000, 0)
2833+
One limit may be left unchanged.
28222834
2823-
so 5000 years ago is on the left of the plot and the
2824-
present is on the right.
2835+
>>> set_xlim(right=right_lim)
28252836
2826-
Returns the current xlimits as a length 2 tuple
2837+
Limits may be passed in reverse order. For example, suppose `x`
2838+
represents the number of years before present. The x-axis limits
2839+
might be set like the following so 5000 years ago is on the left
2840+
of the plot and the present is on the right.
2841+
2842+
>>> set_xlim(5000, 0)
28272843
2828-
ACCEPTS: length 2 sequence of floats
28292844
"""
28302845
if 'xmin' in kw:
28312846
left = kw.pop('xmin')

0 commit comments

Comments
 (0)