next up previous contents index
Next: Rgbformulae Up: Set-show Previous: Pm3d   Contents   Index


Palette is a color storage for use by pm3d, filled color contours or polygons, color histograms, color gradient background, and whatever it is or it will be implemented... Here it stands for a palette of smooth "continuous" colors or grays, but let's call it just a palette.

Color palettes require terminal entries for filled color polygons and palettes of smooth colors, are currently available for terminals listed in help for set pm3d. The range of color values are adjustable independently by set cbrange and set log cb. The whole color palette is visualized in the colorbox.


     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>
                { model { RGB | HSV | CMY | YIQ | XYZ } }
                { 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 palette 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 -6#6 color transformation formulae. show palette colornames prints the implemented color names.

show palette palette 5#5n6#6 prints to screen or to the file given by set output table of RGB triplets calculated for the current palette settings and a palette having 5#5n6#6 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. Additionally to this textual list of RGB table, you can enjoy command test palette to draw graphically the R,G,B profiles for the current 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 -6#6 (R,G,B), i.e. a mapping [0:1] -6#6 ([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 (



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 5#5gamma6#6 can be done for gray maps only (set palette gray). Linear mapping to gray is for gamma equals 1, see test palette (p. [*]). Gamma is ignored for color mappings.

Most terminals support only discrete number of colors (e.g. 256 colors in gif). All entries of the palette remaining after the default gnuplot linetype colors declaration are allocated for pm3d by default. Then multiplot could fail if there are no more color positions in the terminal available. Then you should use set palette maxcolors 5#5maxcolors6#6 with a reasonably small value. This option can also be used to separate levels of z=constant in discrete steps, thus to emulate filled contours. Default value of 0 stays for allocating all remaining entries in the terminal palette or for to use exact mapping to RGB.

RGB color space might not be the most useful color space to work in. For that reason you may change the color space with model to one of RGB, HSV, CMY, YIQ and XYZ. 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, C, Y, or X, 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 and Blue; CMY stands for Cyan, Magenta and Yellow; HSV stands for Hue, Saturation, and Value; YIQ is the color model used by the U.S. Commercial Color Television Broadcasting, it is basically an RGB recoding with downward compatibility for black and white television; XYZ are the three primary colors of the color model defined by the 'Commission Internationale de l'Eclairage' (CIE). For more information on color models see:ñcs/color/glossary.htm ncs/color/glossary.htm


next up previous contents index
Next: Rgbformulae Up: Set-show Previous: Pm3d   Contents   Index
Ethan Merritt 2007-03-03