Control behavior of major tick locators. Because the locator is involved in autoscaling, `~.Axes.autoscale_view` is called automatically after the parameters are changed. Parameters ---------- axis : {'both', 'x', 'y'}, default: 'both' T
(self, axis='both', tight=None, **kwargs)
| 3562 | "This method only works with the ScalarFormatter") from err |
| 3563 | |
| 3564 | def locator_params(self, axis='both', tight=None, **kwargs): |
| 3565 | """ |
| 3566 | Control behavior of major tick locators. |
| 3567 | |
| 3568 | Because the locator is involved in autoscaling, `~.Axes.autoscale_view` |
| 3569 | is called automatically after the parameters are changed. |
| 3570 | |
| 3571 | Parameters |
| 3572 | ---------- |
| 3573 | axis : {'both', 'x', 'y'}, default: 'both' |
| 3574 | The axis on which to operate. (For 3D Axes, *axis* can also be |
| 3575 | set to 'z', and 'both' refers to all three axes.) |
| 3576 | tight : bool or None, optional |
| 3577 | Parameter passed to `~.Axes.autoscale_view`. |
| 3578 | Default is None, for no change. |
| 3579 | |
| 3580 | Other Parameters |
| 3581 | ---------------- |
| 3582 | **kwargs |
| 3583 | Remaining keyword arguments are passed to directly to the |
| 3584 | ``set_params()`` method of the locator. Supported keywords depend |
| 3585 | on the type of the locator. See for example |
| 3586 | `~.ticker.MaxNLocator.set_params` for the `.ticker.MaxNLocator` |
| 3587 | used by default for linear. |
| 3588 | |
| 3589 | Examples |
| 3590 | -------- |
| 3591 | When plotting small subplots, one might want to reduce the maximum |
| 3592 | number of ticks and use tight bounds, for example:: |
| 3593 | |
| 3594 | ax.locator_params(tight=True, nbins=4) |
| 3595 | |
| 3596 | """ |
| 3597 | _api.check_in_list([*self._axis_names, "both"], axis=axis) |
| 3598 | for name in self._axis_names: |
| 3599 | if axis in [name, "both"]: |
| 3600 | loc = self._axis_map[name].get_major_locator() |
| 3601 | loc.set_params(**kwargs) |
| 3602 | self._request_autoscale_view(name, tight=tight) |
| 3603 | self.stale = True |
| 3604 | |
| 3605 | def tick_params(self, axis='both', **kwargs): |
| 3606 | """ |