@@ -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_xlim(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' )
@@ -3037,49 +3064,76 @@ def set_ybound(self, lower=None, upper=None):
3037
3064
3038
3065
def get_ylim (self ):
3039
3066
"""
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
+
3041
3080
"""
3042
3081
return tuple (self .viewLim .intervaly )
3043
3082
3044
3083
def set_ylim (self , bottom = None , top = None , emit = True , auto = False , ** kw ):
3045
3084
"""
3046
- Set the data limits for the yaxis
3085
+ Set the data limits for the y-axis
3047
3086
3048
- Examples::
3087
+ Parameters
3088
+ ----------
3089
+ bottom : scalar, optional
3090
+ The bottom ylim (default: None, which leaves the bottom
3091
+ limit unchanged).
3049
3092
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).
3054
3096
3055
- Keyword arguments:
3097
+ emit : bool, optional
3098
+ Whether to notify observers of limit change (default: True).
3056
3099
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.
3059
3103
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).
3062
3108
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`).
3065
3113
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)
3069
3124
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.
3074
3126
3075
- set_ylim(5000, 0 )
3127
+ >>> set_ylim(top=top_lim )
3076
3128
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.
3079
3134
3080
- Returns the current ylimits as a length 2 tuple
3135
+ >>> set_ylim(5000, 0)
3081
3136
3082
- ACCEPTS: length 2 sequence of floats
3083
3137
"""
3084
3138
if 'ymin' in kw :
3085
3139
bottom = kw .pop ('ymin' )
0 commit comments