@@ -1574,8 +1574,8 @@ def hillshade(self, elevation, vert_exag=1, dx=1, dy=1, fraction=1.):
1574
1574
1575
1575
return intensity
1576
1576
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 ):
1579
1579
"""
1580
1580
Combine colormapped data values with an illumination intensity map
1581
1581
(a.k.a. "hillshade") of the values.
@@ -1603,6 +1603,14 @@ def shade(self, data, cmap, norm=None, blend_mode='hsv',
1603
1603
array (also 0 to 1). (Call signature `func(rgb, illum, **kwargs)`)
1604
1604
Additional kwargs supplied to this function will be passed on to
1605
1605
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.
1606
1614
vert_exag : number, optional
1607
1615
The amount to exaggerate the elevation values by when calculating
1608
1616
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',
1626
1634
rgba : ndarray
1627
1635
An MxNx4 array of floats ranging between 0-1.
1628
1636
"""
1637
+ if vmin is None :
1638
+ vmin = data .min ()
1639
+ if vmax is None :
1640
+ vmax = data .max ()
1629
1641
if norm is None :
1630
- norm = Normalize (vmin = data . min () , vmax = data . max () )
1642
+ norm = Normalize (vmin = vmin , vmax = vmax )
1631
1643
1632
1644
rgb0 = cmap (norm (data ))
1633
1645
rgb1 = self .shade_rgb (rgb0 , elevation = data , blend_mode = blend_mode ,
0 commit comments