matplotlib 3.5.1

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

Parameters

data : 2D array-like

The height values used to generate a shaded map.

cmap : `~matplotlib.colors.Colormap`

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 : float 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 : float 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

ndarray

An MxNx4 array of floats ranging between 0-1.

Combine colormapped data values with an illumination intensity map (a.k.a. "hillshade") of the values.

Examples

See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

matplotlib.colors.LightSource.__init__ matplotlib.colors.LightSource

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /matplotlib/colors.py#2145
type: <class 'function'>
Commit: