@@ -551,8 +551,8 @@ def add_lines(self, levels, colors, linewidths, erase=True):
551551
552552 def _ticker (self ):
553553 '''
554- Return two sequences: ticks (colorbar data locations)
555- and ticklabels (strings).
554+ Return the sequence of ticks (colorbar data locations),
555+ ticklabels (strings), and the corresponding offset string .
556556 '''
557557 locator = self .locator
558558 formatter = self .formatter
@@ -653,6 +653,9 @@ def _process_values(self, b=None):
653653 self ._values = v
654654 return
655655 else :
656+ self .norm .vmin , self .norm .vmax = mtrans .nonsingular (self .norm .vmin ,
657+ self .norm .vmax ,
658+ expander = 0.1 )
656659 if not self .norm .scaled ():
657660 self .norm .vmin = 0
658661 self .norm .vmax = 1
@@ -817,24 +820,21 @@ def _locate(self, x):
817820 # as to make the interpolation more accurate.
818821 b = self .norm (self ._boundaries , clip = False ).filled ()
819822 xn = self .norm (x , clip = False ).filled ()
823+
820824 # The rest is linear interpolation with extrapolation at ends.
821- y = self ._y
822- N = len (b )
823825 ii = np .searchsorted (b , xn )
824826 i0 = ii - 1
825- itop = (ii == N )
827+ itop = (ii == len ( b ) )
826828 ibot = (ii == 0 )
827829 i0 [itop ] -= 1
828830 ii [itop ] -= 1
829831 i0 [ibot ] += 1
830832 ii [ibot ] += 1
831833
832- #db = b[ii] - b[i0]
833834 db = np .take (b , ii ) - np .take (b , i0 )
834- #dy = y[ii] - y[i0]
835+ y = self . _y
835836 dy = np .take (y , ii ) - np .take (y , i0 )
836837 z = np .take (y , i0 ) + (xn - np .take (b , i0 )) * dy / db
837-
838838 return z
839839
840840 def set_alpha (self , alpha ):
0 commit comments