alpha

Sets the transparency of faces of surfaces, patches and images in the current axes.

Category: Graphics > Formatting and Annotation

Syntax

alpha(value)

Sets a uniform transparency for all such objects.

alpha(object, value)

Applies only to the given object.

alpha('flat')

Uses per-face AlphaData.

Description

A value of 0.5 makes the surface see-through, so objects behind it are visible. Transparency is a property of the object, so alpha is a shortcut for setting FaceAlpha (or AlphaData for images).

Input arguments

value
Scalar from 0 (fully transparent) to 1 (fully opaque), or an array of the same size as the data.

Example

Half-transparent surface

surf(peaks(20))
alpha(0.5)
h = findobj(gca, 'Type', 'surface');
disp(h.FaceAlpha)
Output
    0.5000

See also

alim alphamap surf patch