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

Skip to content

Commit 814fff5

Browse files
NelleVtacaswell
authored andcommitted
Merge pull request #7389 from cfackler/update-axes-docstrings-fixed
DOC Convert axes docstrings to numpydoc: #7205 Conflicts: lib/matplotlib/axes/_base.py Minor text conflict in set_xlim docs
1 parent 3d3b8d2 commit 814fff5

File tree

1 file changed

+105
-51
lines changed

1 file changed

+105
-51
lines changed

lib/matplotlib/axes/_base.py

Lines changed: 105 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2783,49 +2783,76 @@ def set_xbound(self, lower=None, upper=None):
27832783

27842784
def get_xlim(self):
27852785
"""
2786-
Get the x-axis range [*left*, *right*]
2786+
Get the x-axis range
2787+
2788+
Returns
2789+
-------
2790+
xlimits : tuple
2791+
Returns the current x-axis limits as the tuple
2792+
(`left`, `right`).
2793+
2794+
Notes
2795+
-----
2796+
The x-axis may be inverted, in which case the `left` value will
2797+
be greater than the `right` value.
2798+
27872799
"""
27882800
return tuple(self.viewLim.intervalx)
27892801

27902802
def set_xlim(self, left=None, right=None, emit=True, auto=False, **kw):
27912803
"""
2792-
Set the data limits for the xaxis
2804+
Set the data limits for the x-axis
27932805
2794-
Examples::
2806+
Parameters
2807+
----------
2808+
left : scalar, optional
2809+
The left xlim (default: None, which leaves the left limit
2810+
unchanged).
27952811
2796-
set_xlim((left, right))
2797-
set_xlim(left, right)
2798-
set_xlim(left=1) # right unchanged
2799-
set_xlim(right=1) # left unchanged
2812+
right : scalar, optional
2813+
The right xlim (default: None, which leaves the right limit
2814+
unchanged).
28002815
2801-
Keyword arguments:
2816+
emit : bool, optional
2817+
Whether to notify observers of limit change (default: True).
28022818
2803-
*left*: scalar
2804-
The left xlim; *xmin*, the previous name, may still be used
2819+
auto : bool or None, optional
2820+
Whether to turn on autoscaling of the x-axis. True turns on,
2821+
False turns off (default action), None leaves unchanged.
28052822
2806-
*right*: scalar
2807-
The right xlim; *xmax*, the previous name, may still be used
2823+
xlimits : tuple, optional
2824+
The left and right xlims may be passed as the tuple
2825+
(`left`, `right`) as the first positional argument (or as
2826+
the `left` keyword argument).
28082827
2809-
*emit*: [ *True* | *False* ]
2810-
Notify observers of limit change
2828+
Returns
2829+
-------
2830+
xlimits : tuple
2831+
Returns the new x-axis limits as (`left`, `right`).
28112832
2812-
*auto*: [ *True* | *False* | *None* ]
2813-
Turn *x* autoscaling on (*True*), off (*False*; default),
2814-
or leave unchanged (*None*)
2833+
Notes
2834+
-----
2835+
The `left` value may be greater than the `right` value, in which
2836+
case the x-axis values will decrease from left to right.
2837+
2838+
Examples
2839+
--------
2840+
>>> set_xlim(left, right)
2841+
>>> set_xlim((left, right))
2842+
>>> left, right = set_xlim(left, right)
28152843
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::
2844+
One limit may be left unchanged.
28202845
2821-
set_ylim(5000, 0)
2846+
>>> set_xlim(right=right_lim)
28222847
2823-
so 5000 years ago is on the left of the plot and the
2848+
Limits may be passed in reverse order to flip the direction of
2849+
the x-axis. For example, suppose `x` represents the number of
2850+
years before present. The x-axis limits might be set like the
2851+
following so 5000 years ago is on the left of the plot and the
28242852
present is on the right.
28252853
2826-
Returns the current xlimits as a length 2 tuple
2854+
>>> set_xlim(5000, 0)
28272855
2828-
ACCEPTS: length 2 sequence of floats
28292856
"""
28302857
if 'xmin' in kw:
28312858
left = kw.pop('xmin')
@@ -3032,49 +3059,76 @@ def set_ybound(self, lower=None, upper=None):
30323059

30333060
def get_ylim(self):
30343061
"""
3035-
Get the y-axis range [*bottom*, *top*]
3062+
Get the y-axis range
3063+
3064+
Returns
3065+
-------
3066+
ylimits : tuple
3067+
Returns the current y-axis limits as the tuple
3068+
(`bottom`, `top`).
3069+
3070+
Notes
3071+
-----
3072+
The y-axis may be inverted, in which case the `bottom` value
3073+
will be greater than the `top` value.
3074+
30363075
"""
30373076
return tuple(self.viewLim.intervaly)
30383077

30393078
def set_ylim(self, bottom=None, top=None, emit=True, auto=False, **kw):
30403079
"""
3041-
Set the data limits for the yaxis
3080+
Set the data limits for the y-axis
30423081
3043-
Examples::
3082+
Parameters
3083+
----------
3084+
bottom : scalar, optional
3085+
The bottom ylim (default: None, which leaves the bottom
3086+
limit unchanged).
30443087
3045-
set_ylim((bottom, top))
3046-
set_ylim(bottom, top)
3047-
set_ylim(bottom=1) # top unchanged
3048-
set_ylim(top=1) # bottom unchanged
3088+
top : scalar, optional
3089+
The top ylim (default: None, which leaves the top limit
3090+
unchanged).
30493091
3050-
Keyword arguments:
3092+
emit : bool, optional
3093+
Whether to notify observers of limit change (default: True).
30513094
3052-
*bottom*: scalar
3053-
The bottom ylim; the previous name, *ymin*, may still be used
3095+
auto : bool or None, optional
3096+
Whether to turn on autoscaling of the y-axis. True turns on,
3097+
False turns off (default action), None leaves unchanged.
30543098
3055-
*top*: scalar
3056-
The top ylim; the previous name, *ymax*, may still be used
3099+
ylimits : tuple, optional
3100+
The bottom and top yxlims may be passed as the tuple
3101+
(`bottom`, `top`) as the first positional argument (or as
3102+
the `bottom` keyword argument).
30573103
3058-
*emit*: [ *True* | *False* ]
3059-
Notify observers of limit change
3104+
Returns
3105+
-------
3106+
ylimits : tuple
3107+
Returns the new y-axis limits as (`bottom`, `top`).
30603108
3061-
*auto*: [ *True* | *False* | *None* ]
3062-
Turn *y* autoscaling on (*True*), off (*False*; default),
3063-
or leave unchanged (*None*)
3109+
Notes
3110+
-----
3111+
The `bottom` value may be greater than the `top` value, in which
3112+
case the y-axis values will decrease from bottom to top.
3113+
3114+
Examples
3115+
--------
3116+
>>> set_ylim(bottom, top)
3117+
>>> set_ylim((bottom, top))
3118+
>>> bottom, top = set_ylim(bottom, top)
30643119
3065-
Note, the *bottom* (formerly *ymin*) value may be greater than
3066-
the *top* (formerly *ymax*).
3067-
For example, suppose *y* is depth in the ocean.
3068-
Then one might use::
3120+
One limit may be left unchanged.
30693121
3070-
set_ylim(5000, 0)
3122+
>>> set_ylim(top=top_lim)
30713123
3072-
so 5000 m depth is at the bottom of the plot and the
3073-
surface, 0 m, is at the top.
3124+
Limits may be passed in reverse order to flip the direction of
3125+
the y-axis. For example, suppose `y` represents depth of the
3126+
ocean in m. The y-axis limits might be set like the following
3127+
so 5000 m depth is at the bottom of the plot and the surface,
3128+
0 m, is at the top.
30743129
3075-
Returns the current ylimits as a length 2 tuple
3130+
>>> set_ylim(5000, 0)
30763131
3077-
ACCEPTS: length 2 sequence of floats
30783132
"""
30793133
if 'ymin' in kw:
30803134
bottom = kw.pop('ymin')

0 commit comments

Comments
 (0)