0
votes

Using gnuplot 5, I want to make a scatter plot using data for more than one series. I know it is possible to say

plot data_file using 1:2 with points, data_file using 3:4 with points

when my series is in different columns; also I could store the data in several data files. What I really would prefer, however, is to store all the data in a single data file and use the first column to indicate set membership, like this:

foo 10 11
foo 12 22
bar 1 4
foo 5 8
bar 2 3

and so on. Is this possible in gnuplot 5?

1

1 Answers

0
votes

you could preprocess the file externally (in order to select a particular group) and instruct Gnuplot to plot it. For example:

dataFile="input.dat"

selectGroup(group, fname)=sprintf("< gawk '$1==\"%s\"{print $2, $3}' %s", group, fname)

plot for [group in "foo bar"] selectGroup(group, dataFile) w p t group