| Types of Color Data The type of color data you specify (i.e., single values or RGB triplets) determines how MATLAB interprets it. When you create a surface plot, you can • Provide no explicit color data, in which case MATLAB generates colormap indices from the z-data. • Specify an array of color data that is equal in size to the z-data and is used for indexed colors. • Specify an m-by-n-by-3 array of color data that defines an RGB triplet for each element in the m-by-nz-data array and is used for truecolor. Colormaps Each MATLAB figure window has a colormap associated with it. A colormap is simply a three-column matrix whose length is equal to the number of colors it defines. Each row of the matrix defines a particular color by specifying three values in the range 0 to 1. These values define the RGB components (i.e., the intensities of the red, green, and blue video components). The colormap function, with no arguments, returns the current figure's colormap. For example, the MATLAB default colormap contains 64 colors and the 57th color is red. cm = colormap; cm(57,:) ans = 10 0 |