@@ -1502,18 +1502,16 @@ def __call__(self, value, clip=None):
15021502 # this gives us the bins in the lookup table in the range
15031503 # [0, _n_regions - 1] (the offset is baked in in the init)
15041504 iret = np .digitize (xx , self .boundaries ) - 1 + self ._offset
1505- # if we have more colors than regions, stretch the region index
1506- # computed above to full range of the color bins. This will
1507- # make use skip some of the colors in the middle of the
1508- # colormap but will use the full range
1505+ # if we have more colors than regions, stretch the region
1506+ # index computed above to full range of the color bins. This
1507+ # will make use of the full range (but skip some of the colors
1508+ # in the middle) such that the first region is mapped to the
1509+ # first color and the last region is mapped to the last color.
15091510 if self .Ncmap > self ._n_regions :
15101511 # the maximum possible value in iret
15111512 divsor = self ._n_regions - 1
15121513 if divsor == 0 :
1513- # special case the 1 region case. What we should do here
1514- # is a bit undefined (as _any_ color in the colormap is
1515- # justifiable) we go with not adjusting the value (which will
1516- # either be 0 or 1 depending on if we are extending down)
1514+ # special case the 1 region case, don't scale anything
15171515 scalefac = 1
15181516 else :
15191517 # otherwise linearly remap the values from the region index
0 commit comments