|On this page…|
The MATLAB® software defines a colormap as a three-column array. Each row of the array defines a particular color by giving three values in the range [0...1]. These values specify the RGB values; the intensity of the red, green, and blue video components.
Colormaps enable you to control how MATLAB maps data values to colors in surfaces, patches, images, and plotting functions that are based on these objects. See the following sections for more information.
The figure Colormap property contains the colormap array. You can specify the figure colormap by setting this property to an m-by-3 array, where m is the number of colors in the colormap.
For example, the following statement creates a figure with a colormap having 128 random colors.
The colormap function is an easy way to specify the colormap. MATLAB also provides a number of functions that generate colormaps. For example,
sets the colormap of the current figure to a 96 element version of the hsv colormap. See the colormap reference page for a list of predefined colormaps. The default colormap is jet(64).