## Palette

The palette is a set of colors, usually ordered in the form of one or more stepped gradients, used for pm3d surfaces and other graph elements colored by z value. Colors in the current palette are automatically mapped from plot coordinates z values or an extra data column of gray values. Palette colors also can be accessed explicitly in a color specification (see colorspec (p. ))

- as a gray value also known as palette fraction in the range [0:1]
- as a z value corresponding to the z coordinate of a plot element
- as a cb value in the range [cbmin:cbmax] (see set cbrange (p. ))

The current palette is shown by default in a separate colorbox drawn next to plots that use plot style pm3d. The colorbox can be manually selected or disabled. See set colorbox (p. ).

Syntax:

         set palette
         set palette {
                    { gray | color }
                    { gamma <gamma> }
                    {   rgbformulae <r>,<g>,<b>
                      | defined { ( <gray1> <color1> {, <grayN> <colorN>}... ) }
                      | file '<filename>' {datafile-modifiers}
                      | functions <R>,<G>,<B>
                    }
                    { cubehelix {start <val>} {cycles <val>} {saturation <val>} }
                    { model { RGB | HSV | CMY } }
                    { positive | negative }
                    { nops_allcF | ps_allcF }
                    { maxcolors <maxcolors> }
                  }
         show palette
         show palette palette <n> {{float | int}}
         show palette gradient
         show palette fit2rgbformulae
         show palette rgbformulae
         show colornames

set palette (i.e. without options) sets up the default values. Otherwise, the options can be given in any order. show palette shows the current palette properties.

show palette gradient displays the gradient defining the palette (if appropriate). show palette rgbformulae prints the available fixed gray – color transformation formulae. show colornames prints the known color names.

show palette palette n prints to the screen or to the file given by set print a table of RGB triplets calculated for the current palette settings and a palette having n discrete colors. The default wide table can be limited to 3 columns of r,g,b float values [0..1] or integer values [0..255] by options float or int, respectively. This way, the current gnuplot color palette can be loaded into other imaging applications, for example Octave. Alternatively, the test palette command will plot the R,G,B profiles for the current palette and leave the profile values in a datablock $PALETTE.

The following options determine the coloring properties.

Figure using this palette can be gray or color. For instance, in pm3d color surfaces the gray of each small spot is obtained by mapping the averaged z-coordinate of the 4 corners of surface quadrangles into the range [min_z,max_z] providing range of grays [0:1]. This value can be used directly as the gray for gray maps. The color map requires a transformation gray – (R,G,B), i.e. a mapping [0:1] – ([0:1],[0:1],[0:1]).

Basically two different types of mappings can be used: Analytic formulae to convert gray to color, or discrete mapping tables which are interpolated. palette rgbformulae and palette functions use analytic formulae whereas palette defined and palette file use interpolated tables. palette rgbformulae reduces the size of postscript output to a minimum.

The command show palette fit2rgbformulae finds the best matching set palette rgbformulae for the current set palette. Naturally, it makes sense to use it for non-rgbformulae palettes. This command can be found useful mainly for external programs using the same rgbformulae definition of palettes as gnuplot, like zimg ( http://zimg.sourceforge.nethttp://zimg.sourceforge.net

).

set palette gray switches to a gray only palette. set palette rgbformulae, set palette defined, set palette file and set palette functions switch to a color mapping. set palette color is an easy way to switch back from the gray palette to the last color mapping.

Automatic gamma correction via set palette gamma gamma can be done for gray maps (set palette gray) and for the cubehelix color palette schemes. Gamma = 1 produces a linear ramp of intensity. See test palette (p. ).

Many terminals support only discrete number of colors (e.g. 256 colors in gif). After the default gnuplot linetype colors are allocated, the rest of the available colors are by default reserved for pm3d. Thus a multiplot using multiple palettes could fail because the first palette has used all the available color positions. You can mitigate this limitation by using set palette maxcolors N with a reasonably small value of N. This option causes N discrete colors to be selected from a continuous palette sampled at equally spaced intervals. If you want unequal spacing of N discrete colors, use set palette defined instead of a single continuous palette.

RGB color space might not be the most useful color space to work in. For that reason you may change the color space model to one of RGB, HSV, CMY. Using color names for set palette defined tables and a color space other than RGB will result in funny colors. All explanation have been written for RGB color space, so please note, that R can be H, or C, depending on the actual color space (G and B accordingly).

All values for all color spaces are limited to [0,1].

RGB stands for Red, Green, Blue; CMY stands for Cyan, Magenta, Yellow; HSV stands for Hue, Saturation, Value. For more information on color models see: http://en.wikipedia.org/wiki/Color_spacehttp://en.wikipedia.org/wiki/Color_space

Note: Earlier gnuplot versions accepted YIQ and XYZ color space models also, but the implementation was never complete or correct.

Subsections

- Rgbformulae
- Defined
- Functions
- Gray
- Cubehelix
- File
- Gamma correction
- Postscript