8000 ticker: cast argument to int to avoid numpy warning · matplotlib/matplotlib@c219323 · GitHub
[go: up one dir, main page]

Skip to content

Commit c219323

Browse files
committed
ticker: cast argument to int to avoid numpy warning
1 parent 16545df commit c219323

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" 7928 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)
0