manpagez: man pages & more
info gnuplot
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

3.15.3.3 index

The index keyword allows you to select specific data sets in a multi-data-set file for plotting.

Syntax:

      plot 'file' index { <m>{:<n>{:<p>}} | "<name>" }

Data sets are separated by pairs of blank records. ‘index <m>‘ selects only set <m>; ‘index <m>:<n>‘ selects sets in the range <m> to <n>; and ‘index <m>:<n>:<p>‘ selects indices <m>, <m>+<p>, <m>+2<p>, etc., but stopping at <n>. Following C indexing, the index 0 is assigned to the first data set in the file. Specifying too large an index results in an error message. If <p> is specified but <n> is left blank then every <p>-th dataset is read until the end of the file. If index is not specified, the entire file is plotted as a single data set.

Example:

      plot 'file' index 4:5

For each point in the file, the index value of the data set it appears in is available via the pseudo-column ‘column(-2)‘. This leads to an alternative way of distinguishing individual data sets within a file as shown below. This is more awkward than the index command if all you are doing is selecting one data set for plotting, but is very useful if you want to assign different properties to each data set. See ‘pseudocolumns‘, ‘lc variable‘.

Example:

      plot 'file' using 1:(column(-2)==4 ? $2 : NaN)        # very awkward
      plot 'file' using 1:2:(column(-2)) linecolor variable # very useful!

‘index ’<name>’‘ selects the data set with name ’<name>’. Names are assigned to data sets in comment lines. The comment character and leading white space are removed from the comment line. If the resulting line starts with <name>, the following data set is now named <name> and can be selected.

Example:

      plot 'file' index 'Population'

Please note that every comment that starts with <name> will name the following data set. To avoid problems it may be useful to choose a naming scheme like ’== Population ==’ or ’[Population]’.

splot with indices demo.</p>


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on November 1, 2013 using texi2html 5.0.

© manpagez.com 2000-2024
Individual documents may contain additional copyright information.