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

Class LightSource

lib/matplotlib/colors.py:3794–4221  ·  view source on GitHub ↗

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. `shade` is used to produce "shaded" RGB values for a data array. `shade_rgb` can be

Source from the content-addressed store, hash-verified

3792
3793
3794class LightSource:
3795 """
3796 Create a light source coming from the specified azimuth and elevation.
3797 Angles are in degrees, with the azimuth measured
3798 clockwise from north and elevation up from the zero plane of the surface.
3799
3800 `shade` is used to produce "shaded" RGB values for a data array.
3801 `shade_rgb` can be used to combine an RGB image with an elevation map.
3802 `hillshade` produces an illumination map of a surface.
3803 """
3804
3805 def __init__(self, azdeg=315, altdeg=45, hsv_min_val=0, hsv_max_val=1,
3806 hsv_min_sat=1, hsv_max_sat=0):
3807 """
3808 Specify the azimuth (measured clockwise from south) and altitude
3809 (measured up from the plane of the surface) of the light source
3810 in degrees.
3811
3812 Parameters
3813 ----------
3814 azdeg : float, default: 315 degrees (from the northwest)
3815 The azimuth (0-360, degrees clockwise from North) of the light
3816 source.
3817 altdeg : float, default: 45 degrees
3818 The altitude (0-90, degrees up from horizontal) of the light
3819 source.
3820 hsv_min_val : number, default: 0
3821 The minimum value ("v" in "hsv") that the *intensity* map can shift the
3822 output image to.
3823 hsv_max_val : number, default: 1
3824 The maximum value ("v" in "hsv") that the *intensity* map can shift the
3825 output image to.
3826 hsv_min_sat : number, default: 1
3827 The minimum saturation value that the *intensity* map can shift the output
3828 image to.
3829 hsv_max_sat : number, default: 0
3830 The maximum saturation value that the *intensity* map can shift the output
3831 image to.
3832
3833 Notes
3834 -----
3835 For backwards compatibility, the parameters *hsv_min_val*,
3836 *hsv_max_val*, *hsv_min_sat*, and *hsv_max_sat* may be supplied at
3837 initialization as well. However, these parameters will only be used if
3838 "blend_mode='hsv'" is passed into `shade` or `shade_rgb`.
3839 See the documentation for `blend_hsv` for more details.
3840 """
3841 self.azdeg = azdeg
3842 self.altdeg = altdeg
3843 self.hsv_min_val = hsv_min_val
3844 self.hsv_max_val = hsv_max_val
3845 self.hsv_min_sat = hsv_min_sat
3846 self.hsv_max_sat = hsv_max_sat
3847
3848 @property
3849 def direction(self):
3850 """The unit vector direction towards the light source."""
3851 # Azimuth is in degrees clockwise from North. Convert to radians

Callers 7

compareFunction · 0.90
display_colorbarFunction · 0.90
avoid_outliersFunction · 0.90
shade_other_dataFunction · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…