GETCOLORMAP

Purpose:

Returns the colormap for density and shaded plots.

Syntax:

GETCOLORMAP(win, mode)

win

-

Optional. A Window containing the input image. Defaults to the system colormap.

mode

-

Optional. An integer. The image source values.

0:

return colormap values directly from displayed bitmap (default).

1:

return colormap values from underlying series data.

Returns:

An Nx3 array of reals ranging from 0.0 to 1.0. N is the number of values for each red, green and blue component.

 

(r, g, b) = getcolormap(win) returns separate red, green and blue components in three NxM arrays where NxM is the size of the input image.

Example:

all = (0..255)/255

zip = zeros(255, 1);

 

map = ravel(all, zip, all);

 

setcolormap(map);showcmap();

 

creates and displays a black to magenta colormap.

 

cmap = getcolormap;

cmap == map returns all ones.

Example:

W1: spline2(rand(10), 3);setplottype(3);rainbow

(r, g, b) = getcolormap(w1)

 

W1 contains a 28x28 random image, The returned r, g and b variables are 28x28 matrices containing the red, green and blue components scaled from 0.0 to 1.0.

Remarks:

The colormap is an array of N rows by 3 columns where 1 <= N <= 255. Each individual RGB (red, green, blue) value is a real number ranging from 0 to 1.0.

 

A window must be specified to use the optional mode argument.

 

If mode is 0, the colormap is derived from the displayed bitmap image, else the colormap is derived from the series data. In general, the difference is negligible.

See Also:

COOL

COPPER

DEFCOLOR

GETRGB

GRAY

HOT

RAINBOW

SETCOLORMAP

SHOWCMAP