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.
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