next up previous contents index
Next: Linecolor variable Up: Linetype, colors, and styles Previous: Linetype, colors, and styles   Contents   Index


Colorspec

Many commands allow you to specify a linetype with an explicit color. Note that not all terminals support RGB colors or pm3d palette colors.

Syntax:


     ... {linetype | lt} <colorspec>
     ... {linecolor | lc} <colorspec>
     ... {textcolor | tc} <colorspec>

where 4#4colorspec5#5 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
     variable                # color index is read from input file

"colorname" refers to one of the color names built in to gnuplot. For a list of the available names, see show palette colornames (p. [*]).

"#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 4#44#4 16) + (0 4#44#4 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 hexadecimal 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 set cbrange (p. [*]). See also set colorbox (p. [*]). 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.


Subsections
next up previous contents index
Next: Linecolor variable Up: Linetype, colors, and styles Previous: Linetype, colors, and styles   Contents   Index
2010-02-22