8000 Convert set_xlim and set_ylim docstrings; #7205 · matplotlib/matplotlib@49a8d83 · GitHub
[go: up one dir, main page]

Skip to content

Commit 49a8d83

Browse files
committed
Convert set_xlim and set_ylim docstrings; #7205
Docstrings converted to numpydoc format.
1 parent a2b990d commit 49a8d83

File tree

1 file changed

+48
-30
lines changed

1 file changed

+48
-30
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 48 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2804,7 +2804,7 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
28042804
emit : bool, optional
28052805
Whether to notify observers of limit change (default: True).
28062806
2807-
auto : {True, False, None}, optional
2807+
auto : bool or None, optional
28082808
Whether to turn on autoscaling of the x-axis. True turns on,
28092809
False turns off (default action), Non 10000 e leaves unchanged.
28102810
@@ -2834,10 +2834,11 @@ def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
28342834
28352835
>>> set_xlim(right=right_lim)
28362836
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.
2837+
Limits may be passed in reverse order to flip the direction of
2838+
the x-axis. For example, suppose `x` represents the number of
2839+
years before present. The x-axis limits might be set like the
2840+
following so 5000 years ago is on the left of the plot and the
2841+
present is on the right.
28412842
28422843
>>> set_xlim(5000, 0)
28432844
@@ -3058,43 +3059,60 @@ def get_ylim(self):
30583059

30593060
def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
30603061
"""
3061-
Set the data limits for the yaxis
3062+
Set the data limits for the y-axis
30623063
3063-
Examples::
3064+
Parameters
3065+
----------
3066+
bottom : scalar, optional
3067+
The bottom ylim (default: None, which leaves the bottom
3068+
limit unchanged). The previous name `ymin` may be used
3069+
instead.
30643070
3065-
set_ylim((bottom, top))
3066-
set_ylim(bottom, top)
3067-
set_ylim(bottom=1) # top unchanged
3068-
set_ylim(top=1) # bottom unchanged
3071+
top : scalar, optional
3072+
The top ylim (default: None, which leaves the top limit
3073+
unchanged). The previous name `ymax` may be used instead.
30693074
3070-
Keyword arguments:
3075+
emit : bool, optional
3076+
Whether to notify observers of limit change (default: True).
30713077
3072-
*bottom*: scalar
3073-
The bottom ylim; the previous name, *ymin*, may still be used
3078+
auto : bool or None, optional
3079+
Whether to turn on autoscaling of the y-axis. True turns on,
3080+
False turns off (default action), None leaves unchanged.
30743081
3075-
*top*: scalar
3076-
The top ylim; the previous name, *ymax*, may still be used
3082+
ylimits : tuple, optional
3083+
The bottom and top yxlims may be passed as the tuple
3084+
(`bottom`, `top`) as the first positional argument (or as
3085+
the `bottom` keyword argument).
30773086
3078-
*emit*: [ *True* | *False* ]
3079-
Notify observers of limit change
3087+
Returns
3088+
-------
3089+
ylimits : tuple
3090+
Returns the current y-axis limits, reflecting any changes
3091+
made by this call, as (`bottom`, `top`).
30803092
3081-
*auto*: [ *True* | *False* | *None* ]
3082-
Turn *y* autoscaling on (*True*), off (*False*; default),
3083-
or leave unchanged (*None*)
3093+
Notes
3094+
-----
3095+
The `bottom` value may be greater than the `top` value, in which
3096+
case the y-axis values will decrease from bottom to top.
30843097
3085-
Note, the *bottom* (formerly *ymin*) value may be greater than
3086-
the *top* (formerly *ymax*).
3087-
For example, suppose *y* is depth in the ocean.
3088-
Then one might use::
3098+
Examples
3099+
--------
3100+
>>> set_ylim(bottom, top)
3101+
>>> set_ylim((bottom, top))
3102+
>>> bottom, top = set_ylim(bottom, top)
3103+
3104+
One limit may be left unchanged.
30893105
3090-
set_ylim(5000, 0)
3106+
>>> set_ylim(top=top_lim)
30913107
3092-
so 5000 m depth is at the bottom of the plot and the
3093-
surface, 0 m, is at the top.
3108+
Limits may be passed in reverse order to flip the direction of
3109+
the y-axis. For example, suppose `y` represents depth of the
3110+
ocean in m. The y-axis limits might be set like the following
3111+
so 5000 m depth is at the bottom of the plot and the surface,
3112+
0 m, is at the top.
30943113
3095-
Returns the current ylimits as a length 2 tuple
3114+
>>> set_ylim(5000, 0)
30963115
3097-
ACCEPTS: length 2 sequence of floats
30983116
"""
30993117
if 'ymin' in kw:
31003118
bottom = kw.pop('ymin')

0 commit comments

Comments
 (0)
0