@@ -1574,8 +1574,8 @@ def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.):
15741574
15751575 return intensity
15761576
1577- def shade (self , data , cmap , norm = None , blend_mode = 'hsv' ,
1578- vert_exag = 1 , dx = 1 , dy = 1 , fraction = 1 , ** kwargs ):
1577+ def shade (self , data , cmap , norm = None , blend_mode = 'hsv' , vmin = None ,
1578+ vmax = None , vert_exag = 1 , dx = 1 , dy = 1 , fraction = 1 , ** kwargs ):
15791579 """
15801580 Combine colormapped data values with an illumination intensity map
15811581 (a.k.a. "hillshade") of the values.
@@ -1603,6 +1603,14 @@ def shade(self, data, cmap, norm=None, blend_mode='hsv',
16031603 array (also 0 to 1). (Call signature `func(rgb, illum, **kwargs)`)
16041604 Additional kwargs supplied to this function will be passed on to
16051605 the *blend_mode* function.
1606+ vmin : scalar or None, optional
1607+ The minimum value used in colormapping *data*. If *None* the
1608+ minimum value in *data* is used. If *norm* is specified, then this
1609+ argument will be ignored.
1610+ vmax : scalar or None, optional
1611+ The maximum value used in colormapping *data*. If *None* the
1612+ maximum value in *data* is used. If *norm* is specified, then this
1613+ argument will be ignored.
16061614 vert_exag : number, optional
16071615 The amount to exaggerate the elevation values by when calculating
16081616 illumination. This can be used either to correct for differences in
@@ -1626,8 +1634,12 @@ def shade(self, data, cmap, norm=None, blend_mode='hsv',
16261634 rgba : ndarray
16271635 An MxNx4 array of floats ranging between 0-1.
16281636 """
1637+ if vmin is None :
1638+ vmin = data .min ()
1639+ if vmax is None :
1640+ vmax = data .max ()
16291641 if norm is None :
1630- norm = Normalize (vmin = data . min () , vmax = data . max () )
1642+ norm = Normalize (vmin = vmin , vmax = vmax )
16311643
16321644 rgb0 = cmap (norm (data ))
16331645 rgb1 = self .shade_rgb (rgb0 , elevation = data , blend_mode = blend_mode ,
0 commit comments