Credits | Overview | Plotting Styles | Commands | Terminals
--- | --- | --- | --- | ---

## 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 must specify the gray values and the corresponding RGB values between which linear interpolation will be done.

Syntax:

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

where N ≥ 2 and <grayN> are gray values which are mapped to [0,1]. The corresponding rgb color <colorN> 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 colornames for a list of known color names.

The <gray> values must 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-to-yellow-to-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" )

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)

Full color HSV spectrum wrapping at some hue other than red

          set palette model HSV start 0.15
          set palette defined ( 0 0 1 1, 1 1 1 1 )

To produce a palette with only a few, equally-spaced colors:

          set palette model RGB maxcolors 4
          set palette defined ( 0 "yellow", 1 "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" )