라이선스가 부여된 사용자만 번역 문서를 볼 수 있습니다. 번역 문서를 보려면 로그인하십시오.


Create light object


handle = light(...)


For a list of properties, see Light Properties.


light creates a light object 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.

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


Light the peaks surface plot with a local light source oriented along the direction defined by the vector [-1 0 0], that is, looking from 0 along the positive x-axis.

light('Position',[-1 0 0],'Style','local')


For more information about lighting, see Lighting Overview.

More About

collapse all


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.

You can specify properties as property name/property value pairs, structure arrays, and cell arrays (see set and get for examples of how to specify these data types).

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

Introduced before R2006a

Was this topic helpful?