Note: This page has been translated by MathWorks. Please click here

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

`FillColorType`

Surface filling types

**MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.**

**MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.**

Inherited | `Dichromatic` , `Flat` , `Functional` , `Monochrome` ,
or `Rainbow` |

Objects | FillColorType Default Values |
---|---|

`plot::Cylindrical` , `plot::Density` , `plot::Dodecahedron` , `plot::Function3d` , `plot::Hexahedron` , `plot::Icosahedron` , `plot::Implicit3d` , `plot::Matrixplot` , `plot::Octahedron` , `plot::Prism` , `plot::Pyramid` , `plot::Spherical` , `plot::Surface` , `plot::SurfaceSet` , `plot::SurfaceSTL` , `plot::Sweep` , `plot::Tetrahedron` , `plot::Tube` , `plot::XRotate` , `plot::ZRotate` | `Dichromatic` |

`plot::Arc3d` , `plot::Ellipse3d` , `plot::Parallelogram3d` , `plot::Waterman` | `Flat` |

`FillColorType`

selects the type of surface
fill color used.

With the exception of `Flat`

and `Functional`

,
the coloring schemes depend on the height, i.e., the *z* value
of points on the surface, in relation to the height of the whole coordinate
system. (Everything on this page relating to surfaces holds for objects
of type `plot::Density`

, too, with the values
plotted replacing height information.)

By default, surfaces are drawn with a linear blend from `FillColor`

to `FillColor2`

.
This behavior may be changed with `FillColorType`

,
using one of the following options:

`Dichromatic`

The default just described.

`Flat`

The surface is filled with

`FillColor`

. No blend is used.`Monochrome`

The surface is filled with a blend from

`FillColor`

to a dimmed version of`FillColor`

.`Rainbow`

This setting is technically similar to

`Dichromatic`

, but the effect is vastly different, since interpolation takes place in HSV color space. This creates a rainbow effect, similar to a physical rainbow for suitable choices of colors.`Functional`

Both

`FillColor`

and`FillColor2`

are ignored; the color scheme is derived from`FillColorFunction`

. See`FillColorFunction`

for details (which depend on the object type). If no color function is given, the object will be rendered with`FillColorType`

=`Flat`

.

In this context, “a blend from *A* to *B*”
means that color *A* is
used at the top of the coordinate system (the part with the lowest *z* coordinate),
color *B* is
used at the bottom and in between each or the red, green, blues, and
alpha channel are interpolated linearly.

By default, function plots use `FillColorType = Dichromatic`

with
a color range from blue to red (as in a temperature scale):

plotfunc3d(sin(x)*sin(y))

Using `FillColorType`

, we color the graph completely
in red:

plotfunc3d(sin(x)*sin(y), FillColorType = Flat)

Note, however, that the coloring is a visual aid, e.g., when looking from above:

plotfunc3d(sin(x)*sin(y), CameraDirection = [0, 0, 1])

plotfunc3d(sin(x)*sin(y), FillColorType = Flat, CameraDirection = [0, 0, 1])

In MuPAD^{®}, rainbow coloring does react to `FillColor`

and `FillColor2`

.
The following plot uses different color settings to show this effect:

plot(plot::Function3d(sin(y), x = 0..10, y = -PI..PI, FillColor = RGB::BlueLight, FillColor2 = RGB::Blue), plot::Function3d(sin(y), x = 0..10, y = PI..3*PI, FillColor = RGB::Green, FillColor2 = RGB::Red), FillColorType = Rainbow, XLinesVisible = FALSE, YLinesVisible = FALSE)

What is happening here technically is that MuPAD performs a
linear interpolation in HSV color space, i.e., the *longest* path
round the following color circle is followed, with saturation and
value (roughly speaking, whiteness and blackness) interpolated linearly:

The opacity of colors is treated the same way in both the `Rainbow`

and `Dichromatic`

settings
of `FillColorType`

, by linear interpolation:

plot((f:=plot::Function3d(sin(y), x = 0..10, y = -PI..PI, FillColorType = Rainbow, FillColor2 = RGB::VioletDark.[0.2], XLinesVisible = FALSE, YLinesVisible = FALSE)))

Setting a `FillColorFunction`

for an object automatically
sets `FillColorType`

to `Functional`

:

colorfunc := (x, y) -> [abs(x)/PI, 0, abs(y)/PI]: f := plot::Function3d(sin(x)*cos(y), x = -PI..PI, y = -PI..PI, FillColorFunction = colorfunc): f::FillColorType

plot(f)

delete colorfunc, f:

Was this topic helpful?