MCPcopy
hub / github.com/matplotlib/matplotlib / convert_units

Method convert_units

lib/matplotlib/axis.py:1948–1963  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

1946 return self._converter is not None or self.units is not None
1947
1948 def convert_units(self, x):
1949 # If x is natively supported by Matplotlib, doesn't need converting
1950 if munits._is_natively_supported(x):
1951 return x
1952
1953 if self._converter is None:
1954 self._set_converter(munits.registry.get_converter(x))
1955
1956 if self._converter is None:
1957 return x
1958 try:
1959 ret = self._converter.convert(x, self.units, self)
1960 except Exception as e:
1961 raise munits.ConversionError('Failed to convert value(s) to axis '
1962 f'units: {x!r}') from e
1963 return ret
1964
1965 def get_converter(self):
1966 """

Callers 9

_set_tick_locationsMethod · 0.95
convert_zunitsMethod · 0.80
set_default_intervalsMethod · 0.80
set_default_intervalsMethod · 0.80
_get_xyMethod · 0.80
convert_xunitsMethod · 0.80
convert_yunitsMethod · 0.80
_process_unit_infoMethod · 0.80
bxpMethod · 0.80

Calls 3

_set_converterMethod · 0.95
get_converterMethod · 0.45
convertMethod · 0.45

Tested by

no test coverage detected