diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py index 754f2158159d..4df8689e9ccb 100644 --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -928,10 +928,12 @@ def set_locs(self, locs=None): # Add labels between bases at log-spaced coefficients; # include base powers in case the locations include # "major" and "minor" points, as in colorbar. - c = np.logspace(0, 1, b//2 + 1, base=b) + c = np.logspace(0, 1, int(b)//2 + 1, base=b) self._sublabels = set(np.round(c)) + # For base 10, this yields (1, 2, 3, 4, 6, 10). else: - self._sublabels = set(np.linspace(1, b, b)) + # Label all integer multiples of base**n. + self._sublabels = set(np.arange(1, b + 1)) def __call__(self, x, pos=None): """