Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 84c25d7

Browse files
ignore pos in __call__
1 parent e70c9d2 commit 84c25d7

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

lib/matplotlib/category.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ def __init__(self, units_mapping):
138138
self._units = units_mapping
139139

140140
def __call__(self, x, pos=None):
141-
return '' if pos is None else self.format_ticks([x])[0]
141+
"""
142+
Return the category label string for tick val *x*.
143+
144+
The position *pos* is ignored.
145+
"""
146+
return self.format_ticks([x])[0]
142147

143148
def format_ticks(self, values):
144149
r_mapping = {v: self._text(k) for k, v in self._units.items()}

lib/matplotlib/tests/test_category.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,8 @@ def test_StrCategoryFormatter(self, ax, ydata):
160160
def test_StrCategoryFormatterPlot(self, ax, ydata, plotter):
161161
plotter(ax, range(len(ydata)), ydata)
162162
for i, d in enumerate(ydata):
163-
assert ax.yaxis.major.formatter(i, i) == d
164-
assert ax.yaxis.major.formatter(i+1, i+1) == ""
165-
assert ax.yaxis.major.formatter(0, None) == ""
163+
assert ax.yaxis.major.formatter(i) == d
164+
assert ax.yaxis.major.formatter(i+1) == ""
166165

167166

168167
def axis_test(axis, labels):

0 commit comments

Comments
 (0)