DADiSP Worksheet Functions > Function Categories > Colors > GETCOLORMAP
Returns the colormap for density and shaded plots.
GETCOLORMAP(win, mode)
win |
- |
Optional. A Window containing the input image. Defaults to the system colormap. |
||||
mode |
- |
Optional. An integer. The image source values.
|
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.
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.
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.
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.