Skip to content

Commit e01f39c

Browse files
committed
Merge pull request matplotlib#2639 from bulli92/master
BUGFIX: ensure that number of classes is always of type INT in Colormap
2 parents f226149 + 71464a8 commit e01f39c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/colors.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -507,13 +507,13 @@ def __init__(self, name, N=256):
507507
508508
"""
509509
self.name = name
510-
self.N = N
510+
self.N = int(N) # ensure that N is always int
511511
self._rgba_bad = (0.0, 0.0, 0.0, 0.0) # If bad, don't paint anything.
512512
self._rgba_under = None
513513
self._rgba_over = None
514-
self._i_under = N
515-
self._i_over = N + 1
516-
self._i_bad = N + 2
514+
self._i_under = self.N
515+
self._i_over = self.N + 1
516+
self._i_bad = self.N + 2
517517
self._isinit = False
518518

519519
#: When this colormap exists on a scalar mappable and colorbar_extend

0 commit comments

Comments
 (0)