1.11 Datastrings
The configuration option –enable-datastrings allows gnuplot to read and
process text fields in datafiles. A text field consists of either an arbitrary
string of printable characters containing no whitespace or an arbitrary string
of characters, possibly including whitespace, delimited by double quotes.
The following sample line from a datafile is interpreted to contain four
columns, with a text field in column 3:
| 1.000 2.000 "Third column is all of this text" 4.00
|
Text fields can be positioned within a 2-D or 3-D plot using the commands:
| plot 'datafile' using 1:2:4 with labels
splot 'datafile using 1:2:3:4 with labels
|
A column of text data can also be used to label the ticmarks along one or more
of the plot axes. The example below plots a line through a series of points
with (X,Y) coordinates taken from columns 3 and 4 of the input datafile.
However, rather than generating regularly spaced tics along the x axis
labeled numerically, gnuplot will position a tic mark along the x axis at the
X coordinate of each point and label the tic mark with text taken from column
1 of the input datafile.
| set xtics
plot 'datafile' using 3:4:xticlabels(1) with linespoints
|
There is also an option that will interpret the first entry in a column of
input data as a text field, and use it as the key title for data plotted from
that column. The example given below will use the first entry in column 2 to
generate a title in the key box, while processing the remainder of columns
2 and 4 to draw the required line:
| plot 'datafile' using 1:(f($2)/$4) title 2 with lines
|
See `set style labels`, `using xticlabels`, title, using.