Documentation

This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.

Colormap Editor

Open colormap editor

Description

The Colormap Editor allows you to customize the colormap of the current figure. Dragging a color marker along the displayed colormap changes the position of a color transition. Double-clicking a marker allows you to change the color at that position. MATLAB® applies all your changes to the colormap of the current figure.

Open the Colormap Editor

MATLAB command prompt: Enter colormapeditor.

Examples

expand all

Create a slice plane for the flow dataset.

[x,y,z,v] = flow;
hz = slice(x,y,z,v,[],[],0);

% Use interpolated color
shading interp

% Set the colormap to jet
colormap jet

% Specify a 2-D view
view(2)

Open the Colormap Editor.

colormapeditor

Delete the cyan marker at index 24. Then move the blue marker at index 8 to index 15.

Notice that the appearance of the plot changes.

Save the colormap in the variable c. You can use c to apply the new colormap to different plots.

ax = gca;
c = colormap(ax);

Parameters

expand all

Color markers allow you to change the color and length of transitions in the colormap.

This table describes the adjustments you can make.

Adjustment

Adjustment Instructions

Change the colormap

Select Tools > Standard Colormaps

Add a color marker

Click below the corresponding cell in the displayed colormap.

Select a marker

Left-click the marker.

Select multiple markers

Adjacent markers: left-click the first marker. Then press Shift before clicking the last marker.

Nonadjacent markers: left-click first marker. Then hold the Ctrl key as you click the other markers.

Move a marker

Select and drag the marker. You can also press the left and right arrow keys instead of dragging the marker.

Move multiple markers

Select multiple markers, and use the left and right arrow keys to move markers as a group. The movement stops when one of the selected markers encounters unselected marker or an end marker.

Delete a marker

Select the marker, and perform one of the following actions:

  • Press the Delete key

  • Select Edit > Delete

  • Press Ctrl+X

Delete multiple markers

Select the markers, and then press the Delete key, or select Delete from the Edit menu, or type Ctrl+X.

Change marker color

Double-click the marker.

Interpolating color space, specified as one of these values:

  • RGB — MATLAB calculates values in the new colormap by linearly interpolating the red, green, and blue components of color.

  • HSV — MATLAB calculates values in the new colormap by linearly interpolating the hue, saturation, and value coordinates. Hue corresponds to the values on a color wheel that transition from red to orange, yellow, green, cyan, blue, magenta, and finally back to red. Hue interpolation is calculated as the shortest distance between adjacent colors on the color wheel.

When you change the Interpolating colorspace, the Colormap Editor preserves the number, color, and location of markers, which can cause the colormap to change.

Colormap lower limit, specified as a number. All values in your plot data that are less than or equal to the value of Color data min map to the first color in the colormap. All values between Color data min and Color data max map linearly to the intermediate colors of the colormap.

When you change Color data min and Color data max, those changes are reflected in the CLim property of the plotting axes.

Colormap upper limit, specified as a number. All values in your plot data that are greater than or equal to the value of Color data max map to the last color in the colormap. All values between Color data min and Color data max map linearly to the intermediate colors of the colormap.

When you change Color data min and Color data max, those changes are reflected in the CLim property of the plotting axes.

Tips

  • To save a colormap after making changes, call the colormap function. Specify the current axes as the input argument, and specify an output argument to store the colormap.

    ax = gca;
    mymap = colormap(ax);
    
    Use the save function to save the colormap as a MAT-file for use in future sessions.
    save('MyColormap','mymap')

  • When you move your mouse over the displayed colormap or any of its markers, the following information displays in the Current color info section:

    • Index — The row in the colormap array that corresponds to the current color.

    • CData — The corresponding value in the CData property of the graphics object that is using the colormap.

    • RGB — The RGB values of the current color.

    • HSV — The HSV values of the current color.

See Also

Functions

Introduced before R2006a

Was this topic helpful?