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

Method __call__

lib/matplotlib/ticker.py:3073–3106  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

3071 self.ndivs = n
3072
3073 def __call__(self):
3074 # docstring inherited
3075 if self.axis.get_scale() == 'log':
3076 _api.warn_external('AutoMinorLocator does not work on logarithmic scales')
3077 return []
3078
3079 majorlocs = np.unique(self.axis.get_majorticklocs())
3080 if len(majorlocs) < 2:
3081 # Need at least two major ticks to find minor tick locations.
3082 # TODO: Figure out a way to still be able to display minor ticks with less
3083 # than two major ticks visible. For now, just display no ticks at all.
3084 return []
3085 majorstep = majorlocs[1] - majorlocs[0]
3086
3087 if self.ndivs is None:
3088 self.ndivs = mpl.rcParams[
3089 'ytick.minor.ndivs' if self.axis.axis_name == 'y'
3090 else 'xtick.minor.ndivs'] # for x and z axis
3091
3092 if self.ndivs == 'auto':
3093 majorstep_mantissa = 10 ** (np.log10(majorstep) % 1)
3094 ndivs = 5 if np.isclose(majorstep_mantissa, [1, 2.5, 5, 10]).any() else 4
3095 else:
3096 ndivs = self.ndivs
3097
3098 minorstep = majorstep / ndivs
3099
3100 vmin, vmax = sorted(self.axis.get_view_interval())
3101 t0 = majorlocs[0]
3102 tmin = round((vmin - t0) / minorstep)
3103 tmax = round((vmax - t0) / minorstep) + 1
3104 locs = (np.arange(tmin, tmax) * minorstep) + t0
3105
3106 return self.raise_if_exceeds(locs)
3107
3108 def tick_values(self, vmin, vmax):
3109 raise NotImplementedError(

Callers

nothing calls this directly

Calls 5

get_scaleMethod · 0.80
get_majorticklocsMethod · 0.80
iscloseMethod · 0.80
raise_if_exceedsMethod · 0.80
get_view_intervalMethod · 0.45

Tested by

no test coverage detected