next up previous contents index
Next: Functions Up: Palette Previous: Rgbformulae   Contents   Index


Defined

Gray-to-rgb mapping can be manually set by use of palette defined: A color gradient is defined and used to give the rgb values. Such a gradient is a piecewise linear mapping from gray values in [0,1] to the RGB space [0,1]x[0,1]x[0,1]. You have to specify the gray values and the corresponding RGB values in between a linear interpolation shall take place:

Syntax:

     set palette  defined { ( <gray1> <color1> {, <grayN> <colorN>}... ) }

5#5grayX6#6 are gray values which are mapped to [0,1] and 5#5colorX6#6 are the corresponding rgb colors. The color can be specified in three different ways:


    <color> :=  { <r> <g> <b> | '<color-name>' | '#rrggbb' }

Either by three numbers (each in [0,1]) for red, green and blue, separated by whitespace, or the name of the color in quotes or X style color specifiers also in quotes. You may freely mix the three types in a gradient definition, but the named color "red" will be something strange if RGB is not selected as color space. Use show palette colornames for a list of known color names.

Please note, that even if written as 5#5r6#6, this might actually be the 5#5H6#6 component in HSV color space or 5#5X6#6 in CIE-XYZ space, or ... depending on the selected color model.

The 5#5gray6#6 values have to form an ascending sequence of real numbers; the sequence will be automatically rescaled to [0,1].

set palette defined (without a gradient definition in braces) switches to RGB color space and uses a preset full-spectrum color gradient. Use show palette gradient to display the gradient.

Examples:

To produce a gray palette (useless but instructive) use:

     set palette model RGB
     set palette defined ( 0 "black", 1 "white" )

To produce a blue yellow red palette use (all equivalent):

     set palette defined ( 0 "blue", 1 "yellow", 2 "red" )
     set palette defined ( 0 0 0 1, 1 1 1 0, 2 1 0 0 )
     set palette defined ( 0 "#0000ff", 1 "#ffff00", 2 "#ff0000" )

To produce some rainbow-like palette use:

     set palette defined ( 0 "blue", 3 "green", 6 "yellow", 10 "red" )

Full color spectrum within HSV color space:

     set palette model HSV
     set palette defined ( 0 0 1 1, 1 1 1 1 )
     set palette defined ( 0 0 1 0, 1 0 1 1, 6 0.8333 1 1, 7 0.8333 0 1)

To produce a palette with few colors only use:

     set palette model RGB maxcolors 4
     set palette defined ( 0 "blue", 1 "green", 2 "yellow", 3 "red" )

'Traffic light' palette (non-smooth color jumps at gray = 1/3 and 2/3).

     set palette model RGB
     set palette defined (0 "dark-green", 1 "green", 1 "yellow", \
                          2 "dark-yellow", 2 "red", 3 "dark-red" )


next up previous contents index
Next: Functions Up: Palette Previous: Rgbformulae   Contents   Index
Ethan Merritt 2007-03-03