COLORMAP
Syntax: |
SET COLORMAP colormapname
|
Note: The value of the COLORMAP
characteristic is a string instead of
a numeric value. So, if you enter:
GET COLORMAP X
, the variable X
will be a string variable.
SET COLORMAP
allows the user to choose a predefined colormap or to create their own colormap
described by RGB codes contained in vectors. Use
GET COLORMAP
to get the current colormap name.
COLORMAPSIZE
is the number of colors in the current colormap.
A colormap is a set of RGB values with values between 0 and 255. The red, green, and blue components combine to make a particular color on the actual drawing, according to the principles of additive color theory. An individual RGB value is expressed using hexadecimal notation, i.e., values from 00 to FF. For example, the RGB value for white:
FF FF FF
the RGB value for black:
00 00 00
while the RGB value for yellow (a combination of red and green) is:
FF FF 00
Predefined Colormaps
There are a number of predefined colormaps, which are chosen by name using the command
SET COLORMAP colormapname
The predefined colormap names are: DEFAULT
, THERMAL
, RAINBOW
,
TOPO256
, REDBLUE16
, GRAY256
, GRAY16
, and
CLASSIC8
. The DEFAULT
colormap is pre-loaded whenever you start the
program. The predefined colormaps are displayed below.
User defined colormaps
Users can create their own colormaps. There can be only one user created colormap and its name is
USERDEFINED
. There are two ways to generate a colormap. The simplest method is to
create three vectors, say rvec
, gvec
, and bvec
, containing
the R, G, B color values between 0 and 255, and enter
SET COLORMAP rvec gvec bvec
The R, G, B color values may also be in a plain text file in hexadecimal format, and enter
SET COLORMAPFILE filename
A colormap file provides a sequence of RGB values in hexadecimal format, one set per line. These are read into the internal colormap, where they are indexed in the same order. That is, line number 1 in the file is color number 1 in the colormap, and so on.
If you load a new colormap, it replaces all the indices of the previous one. It does not replace the fixed standard colors, since those use negative index numbers.