Page 41 - Basics of MATLAB and Beyond
P. 41
Red Green Blue Colour
0 0 0 Black
1 1 1 White
1 0 0 Red
0 1 0 Green
0 0 1 Blue
1 1 0 Yellow
1 0 1 Magenta
0 1 1 Cyan
.5 .5 .5 Gray
.5 0 0 Dark red
1 .62 .4 Dark orange
.49 1 .83 Aquamarine
.95 .9 .8 Parchment
Yellow, for example, consists of the combination of the full intensities
of red and green, with no blue, while gray is the combination of 50%
intensities of red, green, and blue.
You can create your own colour maps or use any of matlab’s many
predefined colour maps:
hsv hot gray bone copper pink
white flag lines colorcube jet prism
cool autumn spring winter summer
Two nonstandard colour maps that are supplied in the companion soft-
ware include redblue and myjet. The first consists of red blending to
blue through shades of gray. The second consists of a modification of
the jet colour map that has white at the top instead of dark red.
These functions all take an optional parameter that specifies the num-
ber of rows (colours) in the colour map matrix. For example, typing
gray(8) creates an 8 × 3 matrix of various levels of gray:
>> gray(8)
ans =
0 0 0
0.1429 0.1429 0.1429
0.2857 0.2857 0.2857
0.4286 0.4286 0.4286
0.5714 0.5714 0.5714
0.7143 0.7143 0.7143
0.8571 0.8571 0.8571
1.0000 1.0000 1.0000
To tell matlab to use a colour map, type it as an input to the colormap
function:
c 2000 by CRC Press LLC