'Combine colormapped data values with an illumination intensity map
(a.k.a.  "hillshade") of the values.
Parameters
data : array-like
A 2d array (or equivalent) of the height values used to generate a
shaded map.
cmap : `~matplotlib.colors.Colormap` instance
The colormap used to color the *data* array. Note that this must be
a `~matplotlib.colors.Colormap` instance.  For example, rather than
passing in `cmap=\'gist_earth\'`, use
`cmap=plt.get_cmap(\'gist_earth\')` instead.
norm : `~matplotlib.colors.Normalize` instance, optional
The normalization used to scale values before colormapping. If
None, the input will be linearly scaled between its min and max.
blend_mode : {\'hsv\', \'overlay\', \'soft\'} or callable, optional
The type of blending used to combine the colormapped data
values with the illumination intensity.  Default is
"overlay".  Note that for most topographic surfaces,
"overlay" or "soft" appear more visually realistic. If a
user-defined function is supplied, it is expected to
combine an MxNx3 RGB array of floats (ranging 0 to 1) with
an MxNx1 hillshade array (also 0 to 1).  (Call signature
`func(rgb, illum, **kwargs)`) Additional kwargs supplied
to this function will be passed on to the *blend_mode*
function.
vmin : scalar or None, optional
The minimum value used in colormapping *data*. If *None* the
minimum value in *data* is used. If *norm* is specified, then this
argument will be ignored.
vmax : scalar or None, optional
The maximum value used in colormapping *data*. If *None* the
maximum value in *data* is used. If *norm* is specified, then this
argument will be ignored.
vert_exag : number, optional
The amount to exaggerate the elevation values by when calculating
illumination. This can be used either to correct for differences in
units between the x-y coordinate system and the elevation
coordinate system (e.g. decimal degrees vs meters) or to exaggerate
or de-emphasize topography.
dx : number, optional
The x-spacing (columns) of the input *elevation* grid.
dy : number, optional
The y-spacing (rows) of the input *elevation* grid.
fraction : number, optional
Increases or decreases the contrast of the hillshade.  Values
greater than one will cause intermediate values to move closer to
full illumination or shadow (and clipping any values that move
beyond 0 or 1). Note that this is not visually or mathematically
the same as vertical exaggeration.
Additional kwargs are passed on to the *blend_mode* function.
Returns
rgba : ndarray
An MxNx4 array of floats ranging between 0-1.'

def shade(self, data, cmap, norm=None, blend_mode=u'overlay', vmin=None, vmax=None, vert_exag=1, dx=1, dy=1, fraction=1, **kwargs):

    if (vmin is None):
        vmin = data.min()
    if (vmax is None):
        vmax = data.max()
    if (norm is None):
        norm = Normalize(vmin=vmin, vmax=vmax)
    rgb0 = cmap(norm(data))
    rgb1 = self.shade_rgb(rgb0, elevation=data, blend_mode=blend_mode, vert_exag=vert_exag, dx=dx, dy=dy, fraction=fraction, **kwargs)
    rgb0[..., :3] = rgb1[..., :3]
    return rgb0
