[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.16.1.2 linecolor 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 variable‘ tells the program to use the value read from one column of the input data as a linestyle index, and use the color belonging to that linestyle. This requires a corresponding additional column in the using specifier. Text colors can be set similarly using ‘tc variable‘.
A single data file may contain multiple sets of data, separated by two blank lines. Each of these separate sets is assigned an index value (see index) that can be retrieved via the using specifier column(-2). See ‘pseudocolumns‘. All data in the file is drawn with the same color/linestyle/pointtype properties by default. The command ‘lc variable‘ can be used to assign different colors to each data set in the file by using the index value from pseudocolumn -2.
Examples:
# Use the third column of data to assign colors to individual points plot 'data' using 1:2:3 with points lc variable |
# Use the data set index to choose a linestyle color plot 'data' using 1:2:(column(-2)) with lines lc variable |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |