## 1.1.1 The palette

Wherever Pyxplot takes a color as an input to a command, the user has three options for how it may be specified. A selection of widely-used colors may be specified by name, for example `red` and `blue`. A complete list of such colors may be found in Section 9.4. Alternatively, an object of type `color` may be provided, such as `rgb(0,1,0)`, `hsb(0.5,0.5,0.5)`, `gray(0.2)`, `colors.green + colors.red`, or `colors.yellow - colors.green`.

The third option is to specify a numbered color from Pyxplot’s palette. By default, this contains a series of visually distinctive colors which are, insofar as possible, also distinctive to users with most common forms of color blindness:

The first color is number 1, the second number 2, and so forth. As well as being accessible by number, these colors also form the default series which Pyxplot chooses for successive datasets when their colors are not individually specified.

The current palette may be queried using the `show palette` command, and changed using the `set palette` command, which takes a comma-separated list of colors, as in the example:

    set palette brickRed, limeGreen, cadetBlue

The palette is treated as a cyclic list, and so in the above example, color number 4 would map to `brickRed`, as would color numbers 1 and 8. The default palette which Pyxplot uses on startup may be changed by setting up a configuration file, as described in Chapter 9.

If a non-integer color is requested from the palette, for example color 1.5, then a color is returned which is half-way in between colors 1 and 2 in RGB space; in this case, brown. This can be used to produce custom color gradients, as the following example demonstrates (the `colormap` plot style will be described in Section 1.12):

`set multiplot`
`set width 8`
`set xformat ”`
`set key xcenter`
`plot [-0.9:0.9] legendreP(6,x)`
`set size 8 ratio 0.2`
`set origin 0,-1.6`
`set nokey`
`set noytics`
`unset xformat`
`set xlabel ’$x$’`
`set palette red , green , blue , purple`
`set colmap 3*c1+1`
`set c1tics -1,0.25`
`set sample grid 200x2`
`plot [-0.9:0.9] legendreP(6,x) with colormap`