Main Content

shading

Set color shading properties

Syntax

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

Description

Theshadingfunction controls the color shading of surface and patch graphics objects.

shading flateach 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 facetedflat shading with superimposed black mesh lines. This is the default shading mode.

shading interpvaries 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 byaxes_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 thetiledlayoutandnexttilefunctions. Call thetiledlayoutfunction to create a 2-by-2 tiled chart layout. Call thenexttilefunction to create the axes. Then display three different spheres using different types of shading.

tiledlayout nexttile sph (2, 2)ere(16) title('Faceted Shading (Default)') nexttile sphere(16) shadingflattitle('Flat Shading') nexttile sphere(16) shadinginterptitle('Interpolated Shading')

Algorithms

shadingsets theEdgeColorandFaceColorproperties of all surface and patch graphics objects in the current axes.shadingsets the appropriate values, depending on whether the surface or patch objects represent meshes or solid surfaces.

Introduced before R2006a