[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
1.11 Datastrings
Data files may contain string data consisting 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 (i.e. the column heading) 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) with lines title columnhead(2)
Another example:
plot for [i=2:6] 'datafile' using i title "Results for ".columnhead(i)
See labels, ‘using xticlabels‘, title, using.
[ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on February 28, 2014 using texi2html 5.0.