gnuplot xy具有多个组的散点图

时间:2017-02-15 10:20:09

标签: gnuplot

使用gnuplot 5,我想使用多个系列的数据制作散点图。我知道可以说

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

当我的系列在不同的列中时;我也可以将数据存储在几个数据文件中。然而,我真正希望的是将所有数据存储在单个数据文件中,并使用第一列来表示集合成员资格,如下所示:

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

等等。这可能在gnuplot 5中吗?

1 个答案:

答案 0 :(得分:0)

您可以在外部预处理文件(以便选择特定的组)并指示Gnuplot绘制它。例如:

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
相关问题