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

## palette

The palette is a set of colors, usually ordered as one or more stepped gradients, used to color pm3d surfaces, heat maps, and other plot elements. Colors in the current palette are automatically mapped from plot coordinate z values or from an extra data column of gray values. The current palette is shown by default in a separate colorbox drawn next to plots that use plot style pm3d. The colorbox can be customized or disabled. See set colorbox. See also show palette and test palette.

Syntax:

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

A palette can be defined in several ways.

- Provide formulae for the red, green, and blue components as a function of the gray value between 0 and 1. Set palette rgbformulae allows you to choose from 36 predefined formulae. Set palette functions allows you to define your own functions. - Use set palette defined to specify one or more smooth gradients, each spanning one segment of the total z range. - Load a previously save palette into the current palette. Set palette file reads a saved palette from a file. Set palette colormap extracts the RGB components from a saved colormap. - Specify a named palette, perhaps with additional parameters to customize. The named palettes currently provided are cubehelix (a customizable family of palettes) and viridis.

set palette (without options) restores the default values.

set palette negative inverts the direction of the palette, e.g. set palette viridis negative creates a gradient from yellow to blue rather than from blue to yellow.

set palette gray switches to a grayscale palette. set palette color restores the most recent color palette.

In pm3d color surfaces the gray value of each small quadrangle is obtained by mapping the averaged z-coordinate of its 4 corners from the range [min_z,max_z] into the range of grays, which is always [0:1]. The palette maps that gray value into an RGB color.

Palette colors can be mentioned explicitly in a color specification (see colorspec). This is useful to assign a palette color to an object or label.

The palette can be defined in any of three color spaces: RGB CMY HSV. See set palette model. All color component values in all color spaces are limited to [0,1].

Subtopics

- rgbformulae
- defined
- functions
- gray
- cubehelix

- viridis
- colormap
- file
- gamma correction
- maxcolors

- Color model
- postscript