@@ -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_xlim(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' )
@@ -3037,49 +3064,76 @@ def set_ybound(self, lower=None, upper=None):
30373064
30383065 def get_ylim (self ):
30393066 """
3040- Get the y-axis range [*bottom*, *top*]
3067+ Get the y-axis range
3068+
3069+ Returns
3070+ -------
3071+ ylimits : tuple
3072+ Returns the current y-axis limits as the tuple
3073+ (`bottom`, `top`).
3074+
3075+ Notes
3076+ -----
3077+ The y-axis may be inverted, in which case the `bottom` value
3078+ will be greater than the `top` value.
3079+
30413080 """
30423081 return tuple (self .viewLim .intervaly )
30433082
30443083 def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
30453084 """
3046- Set the data limits for the yaxis
3085+ Set the data limits for the y-axis
30473086
3048- Examples::
3087+ Parameters
3088+ ----------
3089+ bottom : scalar, optional
3090+ The bottom ylim (default: None, which leaves the bottom
3091+ limit unchanged).
30493092
3050- set_ylim((bottom, top))
3051- set_ylim(bottom, top)
3052- set_ylim(bottom=1) # top unchanged
3053- set_ylim(top=1) # bottom unchanged
3093+ top : scalar, optional
3094+ The top ylim (default: None, which leaves the top limit
3095+ unchanged).
30543096
3055- Keyword arguments:
3097+ emit : bool, optional
3098+ Whether to notify observers of limit change (default: True).
30563099
3057- *bottom*: scalar
3058- The bottom ylim; the previous name, *ymin*, may still be used
3100+ auto : bool or None, optional
3101+ Whether to turn on autoscaling of the y-axis. True turns on,
3102+ False turns off (default action), None leaves unchanged.
30593103
3060- *top*: scalar
3061- The top ylim; the previous name, *ymax*, may still be used
3104+ ylimits : tuple, optional
3105+ The bottom and top yxlims may be passed as the tuple
3106+ (`bottom`, `top`) as the first positional argument (or as
3107+ the `bottom` keyword argument).
30623108
3063- *emit*: [ *True* | *False* ]
3064- Notify observers of limit change
3109+ Returns
3110+ -------
3111+ ylimits : tuple
3112+ Returns the new y-axis limits as (`bottom`, `top`).
30653113
3066- *auto*: [ *True* | *False* | *None* ]
3067- Turn *y* autoscaling on (*True*), off (*False*; default),
3068- or leave unchanged (*None*)
3114+ Notes
3115+ -----
3116+ The `bottom` value may be greater than the `top` value, in which
3117+ case the y-axis values will decrease from bottom to top.
3118+
3119+ Examples
3120+ --------
3121+ >>> set_ylim(bottom, top)
3122+ >>> set_ylim((bottom, top))
3123+ >>> bottom, top = set_ylim(bottom, top)
30693124
3070- Note, the *bottom* (formerly *ymin*) value may be greater than
3071- the *top* (formerly *ymax*).
3072- For example, suppose *y* is depth in the ocean.
3073- Then one might use::
3125+ One limit may be left unchanged.
30743126
3075- set_ylim(5000, 0 )
3127+ >>> set_ylim(top=top_lim )
30763128
3077- so 5000 m depth is at the bottom of the plot and the
3078- surface, 0 m, is at the top.
3129+ Limits may be passed in reverse order to flip the direction of
3130+ the y-axis. For example, suppose `y` represents depth of the
3131+ ocean in m. The y-axis limits might be set like the following
3132+ so 5000 m depth is at the bottom of the plot and the surface,
3133+ 0 m, is at the top.
30793134
3080- Returns the current ylimits as a length 2 tuple
3135+ >>> set_ylim(5000, 0)
30813136
3082- ACCEPTS: length 2 sequence of floats
30833137 """
30843138 if 'ymin' in kw :
30853139 bottom = kw .pop ('ymin' )
0 commit comments