@@ -2788,49 +2788,58 @@ def get_xlim(self):
2788
2788
return tuple (self .viewLim .intervalx )
2789
2789
2790
2790
def set_xlim (self , left = None , right = None , emit = True , auto = False , ** kw ):
2791
- """Set the data limits for the xaxis
2791
+ """Set the data limits for the x-axis
2792
2792
2793
- Call signature::
2794
-
2795
- set_xlim(self, *args, **kwargs):
2793
+ Parameters
2794
+ ----------
2795
+ left : scalar, optional
2796
+ The left xlim (default: None, which leaves the left limit
2797
+ unchanged). The previous name `xmin` may be used instead.
2796
2798
2797
- Set the data limits for the xaxis
2799
+ right : scalar, optional
2800
+ The right xlim (default: None, which leaves the right limit
2801
+ unchanged). The previous name `xmax` may be used instead.
2798
2802
2799
- Examples::
2800
-
2801
- set_xlim((left, right))
2802
- set_xlim(left, right)
2803
- set_xlim(left=1) # right unchanged
2804
- set_xlim(right=1) # left unchanged
2803
+ emit : bool, optional
2804
+ Whether to notify observers of limit change (default: True).
2805
2805
2806
- Keyword arguments:
2806
+ auto : {True, False, None}, optional
2807
+ Whether to turn on autoscaling of the x-axis. True turns on,
2808
+ False turns off (default action), None leaves unchanged.
2807
2809
2808
- *left*: scalar
2809
- The left xlim; *xmin*, the previous name, may still be used
2810
+ xlimits : tuple, optional
2811
+ The left and right xlims may be passed as the tuple
2812
+ (`left`, `right`) as the first positional argument (or as
2813
+ the `left` keyword argument).
2810
2814
2811
- *right*: scalar
2812
- The right xlim; *xmax*, the previous name, may still be used
2815
+ Returns
2816
+ -------
2817
+ xlimits : tuple
2818
+ Returns the current x-axis limits, reflecting any changes
2819
+ made by this call, as (`left`, `right`).
2813
2820
2814
- *emit*: [ *True* | *False* ]
2815
- Notify observers of limit change
2821
+ Notes
2822
+ -----
2823
+ The `left` value may be greater than the `right` value, in which
2824
+ case the x-axis values will decrease from left to right.
2816
2825
2817
- *auto*: [ *True* | *False* | *None* ]
2818
- Turn *x* autoscaling on (*True*), off (*False*; default),
2819
- or leave unchanged (*None*)
2826
+ Examples
2827
+ --------
2828
+ >>> set_xlim(left, right)
2829
+ >>> set_xlim((left, right))
2830
+ >>> left, right = set_xlim(left, right)
2820
2831
2821
- Note, the *left* (formerly *xmin*) value may be greater than
2822
- the *right* (formerly *xmax*).
2823
- For example, suppose *x* is years before present.
2824
- Then one might use::
2832
+ One limit may be left unchanged.
2825
2833
2826
- set_xlim(5000, 0 )
2834
+ >>> set_xlim(right=right_lim )
2827
2835
2828
- so 5000 years ago is on the left of the plot and the
2829
- present is on the right.
2836
+ Limits may be passed in reverse order. For example, suppose `x`
2837
+ represents the number of years before present. The x-axis limits
2838
+ might be set like the following so 5000 years ago is on the left
2839
+ of the plot and the present is on the right.
2830
2840
2831
- Returns the current xlimits as a length 2 tuple
2841
+ >>> set_xlim(5000, 0)
2832
2842
2833
- ACCEPTS: length 2 sequence of floats
2834
2843
"""
2835
2844
if 'xmin' in kw :
2836
2845
left = kw .pop ('xmin' )
0 commit comments