manpagez: man pages & more
info gnuplot
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ] 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.


      # 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] [ ? ]

This document was generated on November 19, 2011 using texi2html 5.0.

© 2000-2017
Individual documents may contain additional copyright information.