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)
| 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): |