Autoscale the axis view to the data (toggle). Convenience method for simple axis view autoscaling. This: - Turns autoscaling on or off (`~.axes.Axes.set_autoscalex_on` / `~.axes.Axes.set_autoscaley_on`). - Ensures that view limits will get updated when ne
(self, enable=True, axis='both', tight=None)
| 3019 | return self._rasterization_zorder |
| 3020 | |
| 3021 | def autoscale(self, enable=True, axis='both', tight=None): |
| 3022 | """ |
| 3023 | Autoscale the axis view to the data (toggle). |
| 3024 | |
| 3025 | Convenience method for simple axis view autoscaling. This: |
| 3026 | |
| 3027 | - Turns autoscaling on or off (`~.axes.Axes.set_autoscalex_on` / |
| 3028 | `~.axes.Axes.set_autoscaley_on`). |
| 3029 | - Ensures that view limits will get updated when needed. - As view limits |
| 3030 | are lazy-updated, this technically marks the view limits as stale. |
| 3031 | |
| 3032 | Parameters |
| 3033 | ---------- |
| 3034 | enable : bool or None, default: True |
| 3035 | True turns autoscaling on, False turns it off. |
| 3036 | None leaves the autoscaling state unchanged. |
| 3037 | axis : {'both', 'x', 'y'}, default: 'both' |
| 3038 | The axis on which to operate. (For 3D Axes, *axis* can also be set |
| 3039 | to 'z', and 'both' refers to all three Axes.) |
| 3040 | tight : bool or None, default: None |
| 3041 | If True, first set the margins to zero. Then, this argument is |
| 3042 | forwarded to `~.axes.Axes.autoscale_view` (regardless of |
| 3043 | its value); see the description of its behavior there. |
| 3044 | |
| 3045 | See Also |
| 3046 | -------- |
| 3047 | :ref:`autoscale` |
| 3048 | matplotlib.axes.Axes.set_autoscale_on |
| 3049 | matplotlib.axes.Axes.set_autoscalex_on |
| 3050 | matplotlib.axes.Axes.set_autoscaley_on |
| 3051 | """ |
| 3052 | if enable is None: |
| 3053 | scalex = True |
| 3054 | scaley = True |
| 3055 | else: |
| 3056 | if axis in ['x', 'both']: |
| 3057 | self.set_autoscalex_on(bool(enable)) |
| 3058 | scalex = self.get_autoscalex_on() |
| 3059 | else: |
| 3060 | scalex = False |
| 3061 | if axis in ['y', 'both']: |
| 3062 | self.set_autoscaley_on(bool(enable)) |
| 3063 | scaley = self.get_autoscaley_on() |
| 3064 | else: |
| 3065 | scaley = False |
| 3066 | if tight and scalex: |
| 3067 | self._xmargin = 0 |
| 3068 | if tight and scaley: |
| 3069 | self._ymargin = 0 |
| 3070 | if scalex: |
| 3071 | self._request_autoscale_view("x", tight=tight) |
| 3072 | if scaley: |
| 3073 | self._request_autoscale_view("y", tight=tight) |
| 3074 | |
| 3075 | def autoscale_view(self, tight=None, scalex=True, scaley=True): |
| 3076 | """ |
no test coverage detected