@@ -893,24 +893,25 @@ def _process_values(self, b=None):
893893 if b is not None :
894894 self ._boundaries = np .asarray (b , dtype = float )
895895 if self .values is None and self .boundaries is not None :
896- # define the outside indices
896+ # define the outside additions
897897 if self .extend == 'min' :
898- i = 0
898+ to_add = self . _boundaries [ 0 ]
899899 elif self .extend == 'max' :
900- i = - 1
900+ to_add = self . _boundaries [ - 1 ]
901901 elif self .extend == 'both' :
902- i = [ 0 , - 1 ]
902+ to_add = self . _boundaries [[ 0 , - 1 ] ]
903903 elif self .extend == 'neither' :
904- i = slice ( None )
904+ to_add = []
905905 # add values to the colorbar insides
906906 boundaries_inside = self ._boundaries [self ._inside ]
907+ n_between = max ((self .cmap .N - len (to_add ))// \
908+ (len (boundaries_inside )- 1 ), 1 )
907909 self ._values = np .linspace (boundaries_inside [:- 1 ],
908910 np .roll (boundaries_inside , - 1 )[:- 1 ],
909- 1000 , endpoint = False ,
910- axis = - 1 ).flatten ()
911+ n_between , endpoint = False ,
912+ axis = - 1 ).flatten ()
911913 self ._values = np .append (self ._values , boundaries_inside [- 1 ])
912914 # add back in the boundaries for the extensions
913- to_add = np .atleast_1d (self ._boundaries [i ])
914915 self ._boundaries = np .sort (np .concatenate ([to_add ,
915916 self ._values ]))
916917 # calculate values at which to plot colors
0 commit comments