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

Method __call__

lib/matplotlib/ticker.py:1373–1392  ·  view source on GitHub ↗
(self, x, pos=None)

Source from the content-addressed store, hash-verified

1371 return f"1-{s}"
1372
1373 def __call__(self, x, pos=None):
1374 if self._minor and x not in self._labelled:
1375 return ""
1376 if x <= 0 or x >= 1:
1377 return ""
1378 if _is_close_to_int(2 * x) and round(2 * x) == 1:
1379 s = self._one_half
1380 elif x < 0.5 and _is_decade(x, rtol=1e-7):
1381 exponent = round(math.log10(x))
1382 s = "10^{%d}" % exponent
1383 elif x > 0.5 and _is_decade(1 - x, rtol=1e-7):
1384 exponent = round(math.log10(1 - x))
1385 s = self._one_minus("10^{%d}" % exponent)
1386 elif x < 0.1:
1387 s = self._format_value(x, self._locs)
1388 elif x > 0.9:
1389 s = self._one_minus(self._format_value(1-x, 1-self._locs))
1390 else:
1391 s = self._format_value(x, self._locs, sci_notation=False)
1392 return r"$\mathdefault{%s}$" % s
1393
1394 def format_data_short(self, value):
1395 # docstring inherited

Callers

nothing calls this directly

Calls 4

_one_minusMethod · 0.95
_format_valueMethod · 0.95
_is_close_to_intFunction · 0.85
_is_decadeFunction · 0.85

Tested by

no test coverage detected