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

Method _set_tick_locations

lib/matplotlib/axis.py:2309–2332  ·  view source on GitHub ↗
(self, ticks, *, minor=False)

Source from the content-addressed store, hash-verified

2307 return ret
2308
2309 def _set_tick_locations(self, ticks, *, minor=False):
2310 # see docstring of set_ticks
2311
2312 # XXX if the user changes units, the information will be lost here
2313 ticks = self.convert_units(ticks)
2314 locator = mticker.FixedLocator(ticks) # validate ticks early.
2315 if len(ticks):
2316 old_vmin, old_vmax = self.get_view_interval()
2317 for axis in self._get_shared_axis():
2318 # set_view_interval maintains any preexisting inversion.
2319 axis.set_view_interval(min(ticks), max(ticks))
2320 new_vmin, new_vmax = self.get_view_interval()
2321 if old_vmin != new_vmin or old_vmax != new_vmax:
2322 self.axes.callbacks.process(
2323 f"{self._get_axis_name()}lim_changed",
2324 self.axes,
2325 )
2326 self.axes.stale = True
2327 if minor:
2328 self.set_minor_locator(locator)
2329 return self.get_minor_ticks(len(ticks))
2330 else:
2331 self.set_major_locator(locator)
2332 return self.get_major_ticks(len(ticks))
2333
2334 def set_ticks(self, ticks, labels=None, *, minor=False, **kwargs):
2335 """

Callers 1

set_ticksMethod · 0.95

Calls 10

convert_unitsMethod · 0.95
get_view_intervalMethod · 0.95
_get_shared_axisMethod · 0.95
_get_axis_nameMethod · 0.95
set_minor_locatorMethod · 0.95
get_minor_ticksMethod · 0.95
set_major_locatorMethod · 0.95
get_major_ticksMethod · 0.95
processMethod · 0.80
set_view_intervalMethod · 0.45

Tested by

no test coverage detected