MCPcopy Index your code
hub / github.com/matplotlib/matplotlib / shade

Method shade

lib/matplotlib/colors.py:3960–4034  ·  view source on GitHub ↗

Combine colormapped data values with an illumination intensity map (a.k.a. "hillshade") of the values. Parameters ---------- data : 2D array-like The height values used to generate a shaded map. cmap : `~matplotlib.colors.Colormap`

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

Source from the content-addressed store, hash-verified

3958 return intensity
3959
3960 def shade(self, data, cmap, norm=None, blend_mode='overlay', vmin=None,
3961 vmax=None, vert_exag=1, dx=1, dy=1, fraction=1, **kwargs):
3962 """
3963 Combine colormapped data values with an illumination intensity map
3964 (a.k.a. "hillshade") of the values.
3965
3966 Parameters
3967 ----------
3968 data : 2D array-like
3969 The height values used to generate a shaded map.
3970 cmap : `~matplotlib.colors.Colormap`
3971 The colormap used to color the *data* array. Note that this must be
3972 a `~matplotlib.colors.Colormap` instance. For example, rather than
3973 passing in ``cmap='gist_earth'``, use
3974 ``cmap=plt.get_cmap('gist_earth')`` instead.
3975 norm : `~matplotlib.colors.Normalize` instance, optional
3976 The normalization used to scale values before colormapping. If
3977 None, the input will be linearly scaled between its min and max.
3978 blend_mode : {'hsv', 'overlay', 'soft'} or callable, optional
3979 The type of blending used to combine the colormapped data
3980 values with the illumination intensity. Default is
3981 "overlay". Note that for most topographic surfaces,
3982 "overlay" or "soft" appear more visually realistic. If a
3983 user-defined function is supplied, it is expected to
3984 combine an (M, N, 3) RGB array of floats (ranging 0 to 1) with
3985 an (M, N, 1) hillshade array (also 0 to 1). (Call signature
3986 ``func(rgb, illum, **kwargs)``) Additional kwargs supplied
3987 to this function will be passed on to the *blend_mode*
3988 function.
3989 vmin : float or None, optional
3990 The minimum value used in colormapping *data*. If *None* the
3991 minimum value in *data* is used. If *norm* is specified, then this
3992 argument will be ignored.
3993 vmax : float or None, optional
3994 The maximum value used in colormapping *data*. If *None* the
3995 maximum value in *data* is used. If *norm* is specified, then this
3996 argument will be ignored.
3997 vert_exag : number, optional
3998 The amount to exaggerate the elevation values by when calculating
3999 illumination. This can be used either to correct for differences in
4000 units between the x-y coordinate system and the elevation
4001 coordinate system (e.g. decimal degrees vs. meters) or to
4002 exaggerate or de-emphasize topography.
4003 dx : number, optional
4004 The x-spacing (columns) of the input *elevation* grid.
4005 dy : number, optional
4006 The y-spacing (rows) of the input *elevation* grid.
4007 fraction : number, optional
4008 Increases or decreases the contrast of the hillshade. Values
4009 greater than one will cause intermediate values to move closer to
4010 full illumination or shadow (and clipping any values that move
4011 beyond 0 or 1). Note that this is not visually or mathematically
4012 the same as vertical exaggeration.
4013 **kwargs
4014 Additional kwargs are passed on to the *blend_mode* function.
4015
4016 Returns
4017 -------

Callers 10

compareFunction · 0.95
display_colorbarFunction · 0.95
avoid_outliersFunction · 0.95
mandelbrot.pyFile · 0.80

Calls 5

shade_rgbMethod · 0.95
NormalizeClass · 0.85
normFunction · 0.85
minMethod · 0.80
maxMethod · 0.80