MATLAB Function Reference | ![]() ![]() |
Syntax
colormapeditor
displays the current figure's colormap as a strip of rectangular cells in the colormap editor. Node pointers are colored cells below the colormap strip that indicate points in the colormap where the rate of the variation of R, G, and B values change. You can also work in the HSV colorspace by setting the Interpolating Colorspace selector to HSV.
You can also start the colormap editor by selecting Colormap from the Edit menu.
Node Pointer Operations
You can select and move node pointers to change a range of colors in the colormap. The color of a node pointer remains constant as you move it, but the colormap changes by linearly interpolating the RGB values between nodes.
Change the color at a node by double-clicking the node pointer. MATLAB displays a color picker from which you can select a new color. After you select a new color at a node, MATLAB reinterpolates the colors in between nodes.
Current Color Info
When you put the mouse over a color cell or node pointer, the colormap editor displays the following information about that colormap element:
CData
property of any image, patch, or surface objects in the figure)
Interpolating Colorspace
The colorspace determines what values are used to calculate the colors of cells between nodes. For example, in the RGB colorspace, internode colors are calculated by linearly interpolating the red, green, and blue intensity values from one node to the next. Switching to the HSV colorspace causes the colormap editor to recalculate the colors between nodes using the hue, saturation, and value components of the color definition.
Note that when you switch from one colorspace to another, the color editor preserves the number, color, and location of the node pointers, which can cause the colormap to change.
Interpolating in HSV: Since hue is conceptually mapped about a color circle, the interpolation between hue values can be ambiguous. To minimize this ambiguity, the interpolation uses the shortest distance around the circle. For example, interpolating between two nodes, one with at hue of 2 (slightly orange red) and another with a hue of 356 (slightly magenta red), does not result in hues 3,4,5...353,354,355 (orange/red-yellow-green-cyan-blue-magenta/red). Taking the shortest distance around the circle gives 357,358,1,2 (orange/red-red-magenta/red).
Color Data Min and Max
The Color Data Min and Color Data Max text fields enable you to specify values for the axes CLim
property. These values change the mapping of object color data (the CData
property of images, patches, and surfaces) to the colormap. See Axes Color Limits -- The Clim Property for discussion and examples of how to use this property.
Examples
This example modifies a default MATLAB colormap so that ranges of data values are displayed in specific ranges of color. The graph is a slice plane illustrating a cross section of fluid flow through a jet nozzle. See the slice
reference page for more information on this type of graph.
Example Objectives
The objectives are as follows:
The following picture shows the desired coloring of the slice plane. The colorbar shows the data to color mapping.
Running the Example
Note If you are viewing this documentation in the MATLAB help browser, you can display the graph used in this example by running this M-file from the MATLAB editor (select Run from the Debug menu). |
Click Run Demo if you want to run a demonstration of the example.
Initially, the default colormap (jet
) colored the slice plane, as illustrated in the following picture. Note that this example uses a colormap that is 48 elements to display wider bands of color (the default is 64 elements).
colormapeditor
command. The color map editor displays the current figure' s colormap, as shown in the following picture.
The slice plane now has the desired range of colors for negative, zero, and positive data.
See Also
Color Operations for related functions.
![]() | colormap | ColorSpec | ![]() |