We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents ca63953 + 59c53c2 commit d7d6947Copy full SHA for d7d6947
lib/matplotlib/category.py
@@ -148,11 +148,11 @@ def __init__(self, units_mapping):
148
self._units = units_mapping
149
150
def __call__(self, x, pos=None):
151
- if pos is None:
152
- return ""
153
- r_mapping = {v: StrCategoryFormatter._text(k)
154
- for k, v in self._units.items()}
155
- return r_mapping.get(int(np.round(x)), '')
+ return '' if pos is None else self.format_ticks([x])[0]
+
+ def format_ticks(self, values):
+ r_mapping = {v: self._text(k) for k, v in self._units.items()}
+ return [r_mapping.get(round(val), '') for val in values]
156
157
@staticmethod
158
def _text(value):
0 commit comments