Create light


handle = light(...)


For a list of properties, see Light Properties.


light creates a light in the current axes. Lights affect only patch and surface objects.

light('PropertyName',propertyvalue,...) creates a Light object using the specified values for the named properties. For a description of the properties, see Light Properties. The MATLAB® software parents the light to the current axes unless you specify another axes with the Parent property.

light(ax,...) creates the light in the axes specified by ax instead of in the current axes (gca). The option ax can precede any of the input argument combinations in the previous syntaxes.

handle = light(...) returns the Light object created.





For more information about lighting, see Lighting Overview.


You cannot see a Light object per se, but you can see the effects of the light source on patch and surface objects. You can also specify an axes-wide ambient light color that illuminates these objects. However, ambient light is visible only when at least one Light object is present and visible in the axes.


See also the Patch Properties and Surface Properties AmbientStrength, DiffuseStrength, SpecularStrength, SpecularExponent, SpecularColorReflectance, and VertexNormals properties. Also see the lighting and material commands.

Introduced before R2006a