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

Method default_units

lib/matplotlib/category.py:89–109  ·  view source on GitHub ↗

Set and update the `~matplotlib.axis.Axis` units. Parameters ---------- data : str or iterable of str axis : `~matplotlib.axis.Axis` axis on which the data is plotted Returns ------- `.UnitData` object storing

(data, axis)

Source from the content-addressed store, hash-verified

87
88 @staticmethod
89 def default_units(data, axis):
90 """
91 Set and update the `~matplotlib.axis.Axis` units.
92
93 Parameters
94 ----------
95 data : str or iterable of str
96 axis : `~matplotlib.axis.Axis`
97 axis on which the data is plotted
98
99 Returns
100 -------
101 `.UnitData`
102 object storing string to integer mapping
103 """
104 # the conversion call stack is default_units -> axis_info -> convert
105 if axis.units is None:
106 axis.set_units(UnitData(data))
107 else:
108 axis.units.update(data)
109 return axis.units
110
111 @staticmethod
112 def _validate_unit(unit):

Callers

nothing calls this directly

Calls 3

UnitDataClass · 0.85
set_unitsMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected