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

Skip to content

Commit 462fe6d

Browse files
authored
Merge pull request #7583 from efiring/ticker_int_N
[MRG] ticker: cast argument to int to avoid numpy warning
2 parents f2c145e + c219323 commit 462fe6d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/matplotlib/ticker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -928,10 +928,12 @@ def set_locs(self, locs=None):
928928
# Add labels between bases at log-spaced coefficients;
929929
# include base powers in case the locations include
930930
# "major" and "minor" points, as in colorbar.
931-
c = np.logspace(0, 1, b//2 + 1, base=b)
931+
c = np.logspace(0, 1, int(b)//2 + 1, base=b)
932932
self._sublabels = set(np.round(c))
933+
# For base 10, this yields (1, 2, 3, 4, 6, 10).
933934
else:
934-
self._sublabels = set(np.linspace(1, b, b))
935+
# Label all integer multiples of base**n.
936+
self._sublabels = set(np.arange(1, b + 1))
935937

936938
def __call__(self, x, pos=None):
937939
"""

0 commit comments

Comments
 (0)