@@ -2270,17 +2270,17 @@ def from_list(cls, *args, adjust_grays=True, **kwargs):
22702270 )
22712271
22722272
2273- def _interpolate_basic (x , x0 , x1 , y0 , y1 ):
2273+ def _interpolate_scalar (x , x0 , x1 , y0 , y1 ):
22742274 """
2275- Basic interpolation between pairs of fixed points.
2275+ Interpolate between two points.
22762276 """
22772277 return y0 + (y1 - y0 ) * (x - x0 ) / (x1 - x0 )
22782278
22792279
2280- def _interpolate_extrapolate (xq , x , y ):
2280+ def _interpolate_extrapolate_vector (xq , x , y ):
22812281 """
2282- Efficient vectorized linear interpolation . Similar to `numpy.interp`
2283- except this does not truncate out-of-bounds values (i.e. is reversible).
2282+ Interpolate between two vectors . Similar to `numpy.interp` except this
2283+ does not truncate out-of-bounds values (i.e. this is reversible).
22842284 """
22852285 # Follow example of _make_lookup_table for efficient, vectorized
22862286 # linear interpolation across multiple segments.
@@ -2428,12 +2428,12 @@ def __init__(self, levels, norm=None, unique=None, step=None, clip=False):
24282428 if unique in ('max' , 'both' ):
24292429 mids [- 1 ] += step * (mids [- 2 ] - mids [- 3 ])
24302430 if vcenter is None :
2431- mids = _interpolate_basic (mids , np .min (mids ), np .max (mids ), vmin , vmax )
2431+ mids = _interpolate_scalar (mids , np .min (mids ), np .max (mids ), vmin , vmax )
24322432 else :
2433- mids [mids < vcenter ] = _interpolate_basic (
2433+ mids [mids < vcenter ] = _interpolate_scalar (
24342434 mids [mids < vcenter ], np .min (mids ), vcenter , vmin , vcenter
24352435 )
2436- mids [mids >= vcenter ] = _interpolate_basic (
2436+ mids [mids >= vcenter ] = _interpolate_scalar (
24372437 mids [mids >= vcenter ], vcenter , np .max (mids ), vcenter , vmax
24382438 )
24392439
@@ -2571,7 +2571,7 @@ def __call__(self, value, clip=None):
25712571 if clip : # numpy.clip can handle masked arrays
25722572 value = np .clip (value , self .vmin , self .vmax )
25732573 xq , is_scalar = self .process_value (value )
2574- yq = _interpolate_extrapolate (xq , self ._x , self ._y )
2574+ yq = _interpolate_extrapolate_vector (xq , self ._x , self ._y )
25752575 if is_scalar :
25762576 yq = np .atleast_1d (yq )[0 ]
25772577 return yq
@@ -2586,7 +2586,7 @@ def inverse(self, value):
25862586 The data to be un-normalized.
25872587 """
25882588 yq , is_scalar = self .process_value (value )
2589- xq = _interpolate_extrapolate (yq , self ._y , self ._x )
2589+ xq = _interpolate_extrapolate_vector (yq , self ._y , self ._x )
25902590 if is_scalar :
25912591 xq = np .atleast_1d (xq )[0 ]
25922592 return xq
@@ -2672,7 +2672,7 @@ def __call__(self, value, clip=None):
26722672 else :
26732673 x = [self .vmin , self .vcenter , self .vmax ]
26742674 y = [0.0 , 0.5 , 1.0 ]
2675- yq = _interpolate_extrapolate (xq , x , y )
2675+ yq = _interpolate_extrapolate_vector (xq , x , y )
26762676 if is_scalar :
26772677 yq = np .atleast_1d (yq )[0 ]
26782678 return yq
0 commit comments