MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / MultipleLocator

Class MultipleLocator

lib/matplotlib/ticker.py:1982–2049  ·  view source on GitHub ↗

Place ticks at every integer multiple of a base plus an offset.

Source from the content-addressed store, hash-verified

1980
1981
1982class MultipleLocator(Locator):
1983 """
1984 Place ticks at every integer multiple of a base plus an offset.
1985 """
1986
1987 def __init__(self, base=1.0, offset=0.0):
1988 """
1989 Parameters
1990 ----------
1991 base : float > 0, default: 1.0
1992 Interval between ticks.
1993 offset : float, default: 0.0
1994 Value added to each multiple of *base*.
1995
1996 .. versionadded:: 3.8
1997 """
1998 self._edge = _Edge_integer(base, 0)
1999 self._offset = offset
2000
2001 def set_params(self, base=None, offset=None):
2002 """
2003 Set parameters within this locator.
2004
2005 Parameters
2006 ----------
2007 base : float > 0, optional
2008 Interval between ticks.
2009 offset : float, optional
2010 Value added to each multiple of *base*.
2011
2012 .. versionadded:: 3.8
2013 """
2014 if base is not None:
2015 self._edge = _Edge_integer(base, 0)
2016 if offset is not None:
2017 self._offset = offset
2018
2019 def __call__(self):
2020 """Return the locations of the ticks."""
2021 vmin, vmax = self.axis.get_view_interval()
2022 return self.tick_values(vmin, vmax)
2023
2024 def tick_values(self, vmin, vmax):
2025 if vmax < vmin:
2026 vmin, vmax = vmax, vmin
2027 step = self._edge.step
2028 vmin -= self._offset
2029 vmax -= self._offset
2030 vmin = self._edge.ge(vmin) * step
2031 n = (vmax - vmin + 0.001 * step) // step
2032 locs = vmin - step + np.arange(n + 3) * step + self._offset
2033 return self.raise_if_exceeds(locs)
2034
2035 def view_limits(self, dmin, dmax):
2036 """
2037 Set the view limits to the nearest tick values that contain the data.
2038 """
2039 if mpl.rcParams['axes.autolimit_mode'] == 'round_numbers':

Callers 3

skewt.pyFile · 0.90
anatomy.pyFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…