Next: , Previous: colorspec, Up: colorspec


1.16.1.1 rgbcolor variable

Most plot commands assign a single color (linetype) to each element of the plot. If there are multiple plots on a single graph, the default color (linetype) is incremented sequentially. You can instead assign a separate color for each data point, line segment, or label based on additional information in the input data file. This is indicated by the colorspec keyword `variable`.

`lc rgbcolor variable` tells the program to use a 24-bit RGB color from a separate column in the data file. This requires a corresponding additional column in the using specifier. The extra column is interpreted as a 24-bit packed RGB triple. These are most easily specified as hexidecimal values (see `rgbcolor`). Text colors are similarly set using `tc rgbcolor variable`.

Example:

           # Place colored points in 3D at the x,y,z coordinates corresponding to
           # their red, green, and blue components
           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