Main Content

shading

Set color shading properties

Syntax

shading flat
shading faceted
shading interp
shading(axes_handle,...)

Description

The shading function controls the color shading of surface and patch graphics objects.

shading flat each mesh line segment and face has a constant color determined by the color value at the endpoint of the segment or the corner of the face that has the smallest index or indices.

shading faceted flat shading with superimposed black mesh lines. This is the default shading mode.

shading interp varies the color in each line segment and face by interpolating the colormap index or true color value across the line or face.

shading(axes_handle,...) applies the shading type to the objects in the axes specified by axes_handle, instead of the current axes. Use single quotes when using a function form. For example:

shading(gca,'interp')

Examples

collapse all

Starting in R2019b, you can display a tiling of plots using the tiledlayout and nexttile functions. Call the tiledlayout function to create a 2-by-2 tiled chart layout. Call the nexttile function to create the axes. Then display three different spheres using different types of shading.

tiledlayout(2,2)
nexttile
sphere(16)
title('Faceted Shading (Default)')

nexttile
sphere(16)
shading flat
title('Flat Shading')

nexttile
sphere(16)
shading interp
title('Interpolated Shading')

Figure contains 3 axes objects. Axes object 1 with title Faceted Shading (Default) contains an object of type surface. Axes object 2 with title Flat Shading contains an object of type surface. Axes object 3 with title Interpolated Shading contains an object of type surface.

Algorithms

shading sets the EdgeColor and FaceColor properties of all surface and patch graphics objects in the current axes. shading sets the appropriate values, depending on whether the surface or patch objects represent meshes or solid surfaces.

Version History

Introduced before R2006a

See Also

| | | | | | | |