Coloring Mesh and Surface Plots
You can enhance the information content of surface plots by controlling the way MATLAB applies color to these plots. MATLAB can map particular data values to colors specified explicitly or can map the entire range of data to a predefined range of colors called a colormap.
There are three coloring techniques:
- Indexed Color - MATLAB colors the surface plot by assigning each data point an index into the figure's colormap. The way MATLAB applies these colors depends on the type of shading used (faceted, flat, or interpolated).
- Truecolor - MATLAB colors the surface plot using the explicitly specified colors (i.e., the RGB triplets). The way MATLAB applies these colors depends on the type of shading used (faceted, flat, or interpolated). To be rendered accurately, truecolor requires computers with 24-bit displays; however, MATLAB simulates truecolor on indexed systems. See the
shading command for information on the types of shading.
- Texture Mapping - Texture mapping diplays a 2-D image mapped onto a 3-D surface.
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-n z-data array and is used for truecolor.
| || Hidden Line Removal|| ||Colormaps |