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

Function convert

lib/matplotlib/tests/test_units.py:53–63  ·  view source on GitHub ↗
(value, unit, axis)

Source from the content-addressed store, hash-verified

51 qc = munits.ConversionInterface()
52
53 def convert(value, unit, axis):
54 if hasattr(value, 'units'):
55 return value.to(unit).magnitude
56 elif np.iterable(value):
57 try:
58 return [v.to(unit).magnitude for v in value]
59 except AttributeError:
60 return [Quantity(v, axis.get_units()).to(unit).magnitude
61 for v in value]
62 else:
63 return Quantity(value, axis.get_units()).to(unit).magnitude
64
65 def default_units(value, axis):
66 if hasattr(value, 'units'):

Callers

nothing calls this directly

Calls 3

QuantityClass · 0.85
toMethod · 0.80
get_unitsMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…