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

## maxcolors

set palette maxcolors <N> limits the palette to N discrete colors 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.

The primary use for this is to generate heat maps with discrete colors, each representing a range of values.

A second use is to handle terminals that support only a limited number of colors (e.g. 256 colors in gif or sixel). The default gnuplot linetype colors use up some of these, further limiting the number available for palette use. Thus a multiplot using multiple palettes could fail because the first palette has used all the available color positions. You can mitigate this by restricting the number of colors used by each palette.