camlight

Creates or moves a light source relative to the camera.

Category: Graphics > Formatting and Annotation

Syntax

camlight

Creates a light to the right of and above the camera.

camlight(direction)

Places it at 'headlight', 'right', 'left', with 'right' as the default.

camlight(az, el)

Places it at the given azimuth and elevation, in degrees, relative to the camera.

h = camlight(___)

Also returns the light handle.

Description

The light is positioned relative to the camera, so it follows the view as you rotate the plot, unless you call camlight again. Lighting has a visible effect only on surfaces and patches with lighting set to gouraud or flat.

Input arguments

direction
Placement name.
az, el
Angles in degrees.

Output arguments

h
Handle of the light object.

Example

A light on a surface

surf(peaks(30))
shading interp
lighting gouraud
h = camlight('right');
disp(class(h))
Output
matlab.graphics.primitive.Light

See also

light lighting surfl material