@@ -2783,49 +2783,76 @@ def set_xbound(self, lower=None, upper=None):
2783
2783
2784
2784
def get_xlim (self ):
2785
2785
"""
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
+
2787
2799
"""
2788
2800
return tuple (self .viewLim .intervalx )
2789
2801
2790
2802
def set_xlim (self , left = None , right = None , emit = True , auto = False , ** kw ):
2791
2803
"""
2792
- Set the data limits for the xaxis
2804
+ Set the data limits for the x-axis
2793
2805
2794
- Examples::
2806
+ Parameters
2807
+ ----------
2808
+ left : scalar, optional
2809
+ The left xlim (default: None, which leaves the left limit
2810
+ unchanged).
2795
2811
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).
2800
2815
2801
- Keyword arguments:
2816
+ emit : bool, optional
2817
+ Whether to notify observers of limit change (default: True).
2802
2818
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.
2805
2822
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).
2808
2827
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`).
2811
2832
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)
2815
2843
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.
2820
2845
2821
- set_ylim(5000, 0 )
2846
+ >>> set_xlim(right=right_lim )
2822
2847
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
2824
2852
present is on the right.
2825
2853
2826
- Returns the current xlimits as a length 2 tuple
2854
+ >>> set_xlim(5000, 0)
2827
2855
2828
- ACCEPTS: length 2 sequence of floats
2829
2856
"""
2830
2857
if 'xmin' in kw :
2831
2858
left = kw .pop ('xmin' )
@@ -3032,49 +3059,76 @@ def set_ybound(self, lower=None, upper=None):
3032
3059
3033
3060
def get_ylim (self ):
3034
3061
"""
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
+
3036
3075
"""
3037
3076
return tuple (self .viewLim .intervaly )
3038
3077
3039
3078
def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
3040
3079
"""
3041
- Set the data limits for the yaxis
3080
+ Set the data limits for the y-axis
3042
3081
3043
- Examples::
3082
+ Parameters
3083
+ ----------
3084
+ bottom : scalar, optional
3085
+ The bottom ylim (default: None, which leaves the bottom
3086
+ limit unchanged).
3044
3087
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).
3049
3091
3050
- Keyword arguments:
3092
+ emit : bool, optional
3093
+ Whether to notify observers of limit change (default: True).
3051
3094
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.
3054
3098
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).
3057
3103
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`).
3060
3108
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)
3064
3119
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.
3069
3121
3070
- set_ylim(5000, 0 )
3122
+ >>> set_ylim(top=top_lim )
3071
3123
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.
3074
3129
3075
- Returns the current ylimits as a length 2 tuple
3130
+ >>> set_ylim(5000, 0)
3076
3131
3077
- ACCEPTS: length 2 sequence of floats
3078
3132
"""
3079
3133
if 'ymin' in kw :
3080
3134
bottom = kw .pop ('ymin' )
0 commit comments