Navigation

Operators and Keywords

Function List:

C++ API

: shading (type)
: shading (hax, type)

Set the shading of patch or surface graphic objects.

Valid arguments for type are

"flat"

Single colored patches with invisible edges.

"faceted"

Single colored patches with black edges.

"interp"

Colors between patch vertices are interpolated and the patch edges are invisible.

If the first argument hax is an axes handle, then plot into this axis, rather than the current axes returned by gca.

See also: fill, mesh, patch, pcolor, surf, surface, hidden, lighting.

Demonstration 1

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading faceted;
 title ('shading ''faceted''');

Produces the following figure

Figure 1

Demonstration 2

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading faceted;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''faceted''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 3

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading flat;
 title ('shading ''flat''');

Produces the following figure

Figure 1

Demonstration 4

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading flat;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''flat''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 5

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading interp;
 title ('shading ''interp''');

Produces the following figure

Figure 1

Demonstration 6

The following code

 clf;
 colormap ("default");
 sombrero ();
 shading interp;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''interp''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 7

The following code

 clf;
 colormap ("default");
 peaks ();
 shading interp;
 h = findobj (gca (), "type", "surface");
 set (h, "edgecolor", "k");
 title ({'shading ''interp''', 'with "edgecolor" set to black'});

Produces the following figure

Figure 1

Demonstration 8

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading faceted;
 title ('shading ''faceted''');

Produces the following figure

Figure 1

Demonstration 9

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading faceted;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''faceted''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 10

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading flat;
 title ('shading ''flat''');

Produces the following figure

Figure 1

Demonstration 11

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading flat;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''flat''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 12

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading interp;
 title ('shading ''interp''');

Produces the following figure

Figure 1

Demonstration 13

The following code

 clf;
 colormap ("default");
 pcolor (peaks ());
 shading interp;
 h = findobj (gca (), "type", "surface");
 facecolor = get (h, "facecolor");
 edgecolor = get (h, "edgecolor");
 set (h, "edgecolor", facecolor, "facecolor", edgecolor);
 title ({'shading ''interp''', 'with "edgecolor" and "facecolor" reversed'});

Produces the following figure

Figure 1

Demonstration 14

The following code

 clf;
 colormap ('default');
 mesh (sombrero ());
 shading interp;
 title ('mesh with shading ''interp''');

Produces the following figure

Figure 1

Demonstration 15

The following code

 clf;
 colormap ('default');
 mesh (sombrero ());
 shading flat;
 title ('mesh with shading ''flat''');

Produces the following figure

Figure 1

Package: octave