Previous: linetype, Up: linetype


1.15.1 colorspec

Many commands allow you to specify a linetype with an explicit color. This option is only possible for terminals that support RGB color or pm3d palettes.

Syntax:

           ... {linetype | lt} <colorspec>
     

where <colorspec> has one of the following forms:

           rgbcolor "colorname"
           rgbcolor "#RRGGBB"
           rgbcolor variable
           palette frac <val>      # <val> runs from 0 to 1
           palette cb <value>      # <val> lies within cbrange
           palette z
     

"colorname" refers to one of the color names built in to gnuplot. For a list of the available names, see colornames.

"#RRGGBB" is a hexadecimal constant preceded by the "#" symbol. The RRGGBB represents the red, green, and blue components of the color, each on a scale from 0 - 255. For example, magenta = full-scale red + full-scale blue would be represented by #FF00FF, which is the hexadecimal representation of (255 << 16) + (0 << 8) + (255).

"rgb variable" requires an additional column in the using specifier, and is only available in 3D plotting mode (splot). The extra column is interpreted as a 24-bit packed RGB triple. These are most easily specified in a data file as hexidecimal values (see above).

Example:

           rgb(r,g,b) = 65536 * int(r) + 256 * int(g) + int(b)
           splot "data" using 1:2:3:(rgb($1,$2,$3)) with points lc rgb variable
     

The color palette is a linear gradient of colors that smoothly maps a single numerical value onto a particular color. Two such mappings are always in effect. `palette frac` maps a fractional value between 0 and 1 onto the full range of the color palette. `palette cb` maps the range of the color axis onto the same palette. See cbrange. See also `set colorbox`. You can use either of these to select a constant color from the current palette.

"palette z" maps the z value of each plot segment or plot element into the cbrange mapping of the palette. This allows smoothly-varying color along a 3D line or surface. It also allows coloring 2D plots by palette values read from an extra column of data.