ColorSpec is not a function; it refers to
the three ways in which you specify color for MATLAB® graphics:
The short names and long names are MATLAB strings that specify one of eight predefined colors. The RGB triplet is a three-element row vector whose elements specify the intensities of the red, green, and blue components of the color; the intensities must be in the range [0 1]. The following table lists the predefined colors and their RGB triplet equivalents.
To change the background color of a figure to green, specify the color with a short name, a long name, or an RGB triplet. These statements generate equivalent results:
whitebg('g') whitebg('green') whitebg([0 1 0]);
You can use
ColorSpec anywhere you need to
define a color. For example, this statement changes the figure background
color to pink:
The eight predefined colors and any colors you specify as RGB triplets are not part of a figure's colormap, nor are they affected by changes to the figure's colormap. They are referred to as fixed colors, as opposed to colormap colors.
Some high-level functions (for example,
accept a colorspec as an input argument and use it to set the
graphic objects they create. When using such functions, take care
not to specify a colorspec in a property/value pair that sets
CData are always n-length vectors
or n-by-3 matrices, where n is the length of