### Navigation

- index
- modules |
- next |
- previous |
- home|
- examples|
- tutorials|
- pyplot|
- docs »
- The Matplotlib API »
- colors »

# matplotlib.colors.LightSource

class `matplotlib.colors.``LightSource`(azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1, hsv_min_sat=1, hsv_max_sat=0)

  Create a light source coming from the specified azimuth and elevation. Angles are in degrees, with the azimuth measured clockwise from north and elevation up from the zero plane of the surface.

  The `shade()` is used to produce “shaded” rgb values for a data array. `shade_rgb()` can be used to combine an rgb image with The `shade_rgb()` The `hillshade()` produces an illumination map of a surface.

  Specify the azimuth (measured clockwise from south) and altitude (measured up from the plane of the surface) of the light source in degrees.

  Parameters: | azdeg : number, optional The azimuth (0-360, degrees clockwise from North) of the light source. Defaults to 315 degrees (from the northwest). altdeg : number, optional The altitude (0-90, degrees up from horizontal) of the light source. Defaults to 45 degrees from horizontal.

  Notes

  For backwards compatibility, the parameters hsv_min_val, hsv_max_val, hsv_min_sat, and hsv_max_sat may be supplied at initialization as well. However, these parameters will only be used if “blend_mode=’hsv’” is passed into `shade()` or `shade_rgb()`. See the documentation for `blend_hsv()` for more details.

## Examples using `matplotlib.colors.LightSource`

Frontpage 3D example

Shading Example

Custom hillshading in a 3D surface plot

Demo Agg Filter

Shaded & power normalized rendering

Hillshading

Topographic hillshading