matplotlib 3.5.1

ParametersReturnsBackRef
shade_rgb(self, rgb, elevation, fraction=1.0, blend_mode='hsv', vert_exag=1, dx=1, dy=1, **kwargs)

Parameters

rgb : array-like

An (M, N, 3) RGB array, assumed to be in the range of 0 to 1.

elevation : array-like

An (M, N) array of the height values used to generate a shaded map.

fraction : number

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.

blend_mode : {'hsv', 'overlay', 'soft'} or callable, optional

The type of blending used to combine the colormapped data values with the illumination intensity. For backwards compatibility, this defaults to "hsv". 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.

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.

Additional kwargs are passed on to the *blend_mode* function. :

Returns

ndarray

An (m, n, 3) array of floats ranging between 0-1.

Use this light source to adjust the colors of the rgb input array to give the impression of a shaded relief map with the given elevation.

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#2220
type: <class 'function'>
Commit: