| Contents | Index |
MuPAD® uses the RGB color model, i.e., colors are specified by lists [r, g, b] of red, green, and blue values between
and
. Black and white correspond to[0, 0, 0] and [1, 1, 1], respectively. The library RGB contains numerous color names with corresponding RGB values:
RGB::Black, RGB::White, RGB::Red, RGB::SkyBlue
![]()
You may list all color names available in the RGB library via info(RGB). Alternatively, there is the command RGB::ColorNames() returning a complete list of names, optionally filtered. For example, let us list all the colors whose names contain “Red”:
RGB::ColorNames(Red)
![[CadmiumRedDeep, CadmiumRedLight, CardinalRed, CarmineRed, DarkRed, EnglishRed, IndianRed, OrangeRed, PermanentRedViolet, Red, VenetianRed, VioletRed, VioletRedMedium, VioletRedPale]](INTRO_RGBColors_images/math3.png)
To get them displayed, use
RGB::plotColorPalette("red")

After loading the color library via use(RGB), you can use the color names in the short form Black, White, IndianRed etc.
In MuPAD, the color of all graphic elements can either be specified by RGB or RGBa values.
RGBa color values consist of lists [r, g, b, a] containing a fourth entry: the “opacity” value a between
and
. For a = 0, a surface patch painted with this RGBa color is fully transparent (i.e., invisible). For a = 1, the surface patch is opaque, i.e., it hides plot objects that are behind it. For
, the surface patch is semi-transparent, i.e., plot objects behind it “shine through.”
RGBa color values can be constructed easily via the RGB library. One only has to append a fourth entry to the
lists provided by the color names. The easiest way to do this is to append the list [a] to the RGB list via the concatenation operator ‘.’. We create a semi-transparent ‘grey’:
RGB::Grey.[0.5]
![]()
The following command plots a highly transparent red box, containing a somewhat less transparent green box with an opaque blue box inside:
plot(
plot::Box(-3..3, -3..3, -3..3, FillColor = RGB::Red.[0.2]),
plot::Box(-2..2, -2..2, -2..2, FillColor = RGB::Green.[0.3]),
plot::Box(-1..1, -1..1, -1..1, FillColor = RGB::Blue),
LinesVisible = TRUE, LineColor = RGB::Black,
Scaling = Constrained
):

In the following example, we plot points randomly distributed with random colors and random translucencies:
plot(plot::PointList2d([[frandom() $ i = 1..2,
[frandom() $ i = 1..4]]
$ i = 1..300],
PointSize=4),
Axes=None, Scaling=Constrained)

Utility functions
RGB::ColorNames, RGB::plotColorPalette – find predefined colors by name
RGB::colorName – find names of predefined colors
RGB::fromWaveLength – get the RGB color of monochromatic light
RGB::random – Pick a color uniformly at random in RGB color space

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 |