Graphics |
Figure Colormaps -- The Colormap Property
MATLAB 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.
Coloring Mesh and Surface Plots in 3-D Visualization
Specifying Patch Coloring in 3-D Visualization
The Image Object and Its Properties
Specifying the Figure Colormap
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. Note that the default colormap is jet(64)
.
Example -- Specifying Figure Position | Selecting Drawing Methods |
© 1994-2005 The MathWorks, Inc.