Navigation

Operators and Keywords

Function List:

C++ API

Function File: cmap = colormap ()
Function File: cmap = colormap (map)
Function File: cmap = colormap ("default")
Function File: cmap = colormap ("map_name")
Function File: cmap = colormap (hax, …)
Command: colormap map_name
Function File: cmaps = colormap ("list")
Function File: colormap ("register", "name")
Function File: colormap ("unregister", "name")

Query or set the current colormap.

With no input arguments, colormap returns the current color map.

colormap (map) sets the current colormap to map. The colormap should be an n row by 3 column matrix. The columns contain red, green, and blue intensities respectively. All entries must be between 0 and 1 inclusive. The new colormap is returned.

colormap ("default") restores the default colormap (the jet map with 64 entries). The default colormap is returned.

The map may also be specified by a string, "map_name", where map_name is the name of a function that returns a colormap.

If the first argument hax is an axes handle, then the colormap for the parent figure of hax is queried or set.

For convenience, it is also possible to use this function with the command form, colormap map_name.

colormap ("list") returns a cell array with all of the available colormaps. The options "register" and "unregister" add or remove the colormap name from this list.

See also: jet.

Demonstration 1

The following code

 ## Create an image for displaying a colormap
 image (1:64, linspace (0, 1, 64), repmat ((1:64)', 1, 64));
 axis ([1, 64, 0, 1], "ticy", "xy");
 ## Show 'jet' colormap
 colormap (jet (64));
 title "colormap (jet (64))"
 disp ("Press a key to continue");
 pause ();
 ## Show 'colorcube' colormap
 colormap (colorcube (64));
 title "colormap (colorcube (64))"

Produces the following output

Press a key to continue

and the following figure

Figure 1

Package: octave