@@ -1473,18 +1473,18 @@ def __init__(self, boundaries, ncolors, clip=False, *, extend='neither'):
14731473 self .Ncmap = ncolors
14741474 self .extend = extend
14751475
1476- self ._N = self .N - 1 # number of colors needed
1476+ self ._n_regions = self .N - 1 # number of colors needed
14771477 self ._offset = 0
14781478 if extend in ('min' , 'both' ):
1479- self ._N += 1
1479+ self ._n_regions += 1
14801480 self ._offset = 1
14811481 if extend in ('max' , 'both' ):
1482- self ._N += 1
1483- if self ._N > self .Ncmap :
1484- raise ValueError (f"There are { self ._N } color bins including "
1485- f" extensions, but ncolors = { ncolors } ; "
1486- " ncolors must equal or exceed the number of "
1487- "bins" )
1482+ self ._n_regions += 1
1483+ if self ._n_regions > self .Ncmap :
1484+ raise ValueError (f"There are { self ._n_regions } color bins "
1485+ "including extensions, but ncolors = "
1486+ f" { ncolors } ; ncolors must equal or exceed the "
1487+ "number of bins" )
14881488
14891489 def __call__ (self , value , clip = None ):
14901490 if clip is None :
@@ -1499,8 +1499,8 @@ def __call__(self, value, clip=None):
14991499 else :
15001500 max_col = self .Ncmap
15011501 iret = np .digitize (xx , self .boundaries ) - 1 + self ._offset
1502- if self .Ncmap > self ._N :
1503- scalefac = (self .Ncmap - 1 ) / (self ._N - 1 )
1502+ if self .Ncmap > self ._n_regions :
1503+ scalefac = (self .Ncmap - 1 ) / (self ._n_regions - 1 )
15041504 iret = (iret * scalefac ).astype (np .int16 )
15051505 iret [xx < self .vmin ] = - 1
15061506 iret [xx >= self .vmax ] = max_col
0 commit comments