Skip to Main Content Skip to Search
Product Documentation

FillColorcolor of areas and surfaces

FillColor2second color of areas and surfaces for color blends

FillColor determines the color used to fill all types of areas and surfaces. FillColor2 is used for color blends. FillColors is used for objects that need more than one color.

→ Examples

Attribute

Type

Value

See Also:

FillColorType, Filled, FillPattern, LineColor, Shading

Details:

Example 1

By default, plot::Hatch objects are hatched in RGB::Red, the same color used by default for plot::Function2d:

f := plot::Function2d(cos(2*x)+cos(x), x=-PI..PI):
h := plot::Hatch(f):
plot(h, f)

MuPAD graphics

To change the color of the hatch, simply set the "FillColor"-slot to some other value:

h::FillColor := RGB::Grey:
plot(h, f)

MuPAD graphics

Example 2

The default setting for a surface is to have a height-dependent coloring with a linear blend from FillColor to FillColor2:

s := plot::Surface([cos(2*u+v), sin(u+2*v), sin(u+v)],
                   u = 0..2*PI, v = 0..2*PI,
                   ULinesVisible = FALSE,
                   VLinesVisible = FALSE):
plot(s)

MuPAD graphics

These colors can be manipulated in the usual way. As an example, we set the transition to a monochrome transition from opaque to transparent:

s::FillColor  := RGB::Green:
s::FillColor2 := s::FillColor . [0.0]:
plot(s)

MuPAD graphics

Example 3

Using a utility function randrange that returns random ranges in [0, 1], we can plot random rectangles with random colors:

randrange := () -> _range(op(sort([frandom(), frandom()]))):
plot(plot::Rectangle(randrange(), randrange(),
                     LinesVisible = FALSE,
                     Filled = TRUE, FillPattern = Solid,
                     FillColor = [frandom(), frandom(), frandom()])
     $k=1..20,
     AxesVisible = FALSE)

MuPAD graphics

  


Recommended Products

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.

 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS