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

Method _format

lib/matplotlib/widgets.py:950–965  ·  view source on GitHub ↗

Pretty-print *val*.

(self, val)

Source from the content-addressed store, hash-verified

948 event.xdata if self.orientation == "horizontal" else event.ydata)
949
950 def _format(self, val):
951 """Pretty-print *val*."""
952 if self.valfmt is not None:
953 if callable(self.valfmt):
954 return f"({self.valfmt(val[0])}, {self.valfmt(val[1])})"
955 else:
956 return f"({self.valfmt % val[0]}, {self.valfmt % val[1]})"
957 else:
958 _, s1, s2, _ = self._fmt.format_ticks(
959 [self.valmin, *val, self.valmax]
960 )
961 # fmt.get_offset is actually the multiplicative factor, if any.
962 s1 += self._fmt.get_offset()
963 s2 += self._fmt.get_offset()
964 # Use f string to avoid issues with backslashes when cast to a str
965 return f"({s1}, {s2})"
966
967 def set_min(self, min):
968 """

Callers 2

__init__Method · 0.95
set_valMethod · 0.95

Calls 2

format_ticksMethod · 0.45
get_offsetMethod · 0.45

Tested by

no test coverage detected