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

Method set_locs

lib/matplotlib/ticker.py:1505–1523  ·  view source on GitHub ↗
(self, locs)

Source from the content-addressed store, hash-verified

1503 return self._format_maybe_minus_and_locale(self._format, xp)
1504
1505 def set_locs(self, locs):
1506 # docstring inherited
1507 self._locs = locs
1508 if len(self._locs) > 0:
1509 vmin, vmax = sorted(self.axis.get_view_interval())
1510 if self._useOffset:
1511 self._compute_offset()
1512 if self.offset != 0:
1513 # We don't want to use the offset computed by
1514 # self._compute_offset because it rounds the offset unaware
1515 # of our engineering prefixes preference, and this can
1516 # cause ticks with 4+ digits to appear. These ticks are
1517 # slightly less readable, so if offset is justified
1518 # (decided by self._compute_offset) we set it to better
1519 # value:
1520 self.offset = round((vmin + vmax)/2, 3)
1521 # Use log1000 to use engineers' oom standards
1522 self._orderOfMagnitude = math.floor(math.log(vmax - vmin, 1000))*3
1523 self._set_format()
1524
1525 # Simplify a bit ScalarFormatter.get_offset: We always want to use
1526 # self.format_data. Also we want to return a non-empty string only if there

Callers

nothing calls this directly

Calls 3

_compute_offsetMethod · 0.80
_set_formatMethod · 0.80
get_view_intervalMethod · 0.45

Tested by

no test coverage detected