amep.plot.set_locators#

amep.plot.set_locators(axis: Axes | ndarray, which: str = 'both', major: float = 10, minor: float = 1) None#

Set the locations of major and minor ticks.

Parameters:
  • axis (AxesSubplot or array of AxesSubplot objects) – Axis (matplotlib.pyplot axis object) for which the location of ticks should be modified.

  • which (str, optional) – Apply the locators to this axis (‘x’, ‘y’, or ‘both’). The default is ‘both’.

  • major (float, optional) – Distance between major ticks. The default is 10.

  • minor (float, optional) – Distance between minor ticks. The default is 1.

Return type:

None.

Examples

>>> import amep
>>> import numpy as np
>>> fig, axs = amep.plot.new(ncols=3, figsize=(9,3))
>>> x = np.arange(20)
>>> y = 2*x
>>> axs[0].plot(x, y)
>>> axs[1].plot(x, y**2)
>>> axs[2].plot(x, y/2)
>>> amep.plot.set_locators(axs[:1], which='x', major=5, minor=1)
>>> amep.plot.set_locators(axs[0], which='y', major=10, minor=2)
>>> amep.plot.set_locators(axs[1], which='y', major=200, minor=50)
>>> amep.plot.set_locators(axs[2], which='both', major=5, minor=1)
>>> fig.savefig('./figures/plot/plot-set_locators.png')
>>>
../_images/plot-set_locators.png