@@ -1300,13 +1300,11 @@ def __call__(self, value, clip=None):
13001300
13011301 if not self .vmin <= self .vcenter <= self .vmax :
13021302 raise ValueError ("vmin, vcenter, vmax must increase monotonically" )
1303- # must linearly extrapolate for ticks on colorbars that go
1304- # beyond vmin and vmax:
1305- min = self .vmin - (self .vcenter - self .vmin )
1306- max = self .vmax + (self .vmax - self .vcenter )
1303+ # note that we must extrapolate for tick locators:
13071304 result = np .ma .masked_array (
1308- np .interp (result , [min , self .vcenter , max ],
1309- [- 0.5 , 0.5 , 1.5 ]), mask = np .ma .getmask (result ))
1305+ np .interp (result , [self .vmin , self .vcenter , self .vmax ],
1306+ [0 , 0.5 , 1 ], left = - np .inf , right = np .inf ),
1307+ mask = np .ma .getmask (result ))
13101308 if is_scalar :
13111309 result = np .atleast_1d (result )[0 ]
13121310 return result
@@ -1317,9 +1315,8 @@ def inverse(self, value):
13171315 (vmin ,), _ = self .process_value (self .vmin )
13181316 (vmax ,), _ = self .process_value (self .vmax )
13191317 (vcenter ,), _ = self .process_value (self .vcenter )
1320- min = vmin - (vcenter - vmin )
1321- max = vmax + (vmax - vcenter )
1322- result = np .interp (value , [- 0.5 , 0.5 , 1.5 ], [min , vcenter , max ])
1318+ result = np .interp (value , [0 , 0.5 , 1 ], [vmin , vcenter , vmax ],
1319+ left = - np .inf , right = np .inf )
13231320 return result
13241321
13251322
0 commit comments