Previous: linecolor_variable, Up: colorspec


1.17.1.3 rgbcolor variable

You can assign a separate color for each data point, line segment, or label in your plot. `lc rgbcolor variable` tells the program to read RGB color information for each line 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. If the value is provided directly in the data file it is easiest to give it as a hexidecimal value (see `rgbcolor`). Alternatively, the using specifier can contain an expression that evaluates to a 24-bit RGB color as in the example below. 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