需要在gnuplot中绘制每个第n行

Rob*_*ood 4 gnuplot data-manipulation

我正在使用gnuplot并且有一些具有2个以上参数的数据.我不想使用3D图表.因此,我将在同一个图中将数据分成几行.

在一种情况下,我的数据看起来像这样:

    #k   #N   #time   
1   1   0.000556134 
2   1   0.00099 
4   1   0.00201011  
8   1   0.00376214  
16  1   0.00675843  
1   2   0.000717646 
2   2   0.000794106 
4   2   0.0016033   
8   2   0.0033602   
16  2   0.00795338  
1   4   0.000476448
...     ...     ... 
Run Code Online (Sandbox Code Playgroud)

首先是我使用的流的数量,第二个是缓冲区大小,最后一个是此操作的时间使用.

我想要一个图表,其中缓冲区大小为X,时间Y,并且每个"使用的流量"都有一行.我的代码到现在为止:

     reset
        set   autoscale # scale axes automatically
        unset log       # remove any log-scaling
        unset label     # remove any previous labels
        set xtic auto   # set xtics automatically
        set ytic auto   # set ytics automatically
        #set logscale x 2
        #set logscale y 2
        set rmargin 10
        set bmargin 5
        set tmargin 5 
        set key left top
        set title
        set term png giant size 1500, 800 crop

        set title "Adapter Stream Input" font "verdana, 20"
        set xlabel "Buffer Size" font "verdana, 20"
        set ylabel "Time in Seconds" font "verdana, 20"

        set key right bottom spacing 4 width 5 height 5 font "verdana, 15"

        set output "AdapterStreamInputTests.png"

        plot    "AdapterStreamInputTests.txt" using ($1 == 1 ? $2 : 1/0):($1 == 1 ? $3 : 1/0) title '1 Stream' with linespoints ls 1 linecolor rgb "blue", \
        "AdapterStreamInputTests.txt" using ($1 == 2 ? $2 : 1/0):($1 == 2 ? $3 : 1/0) title '2 Stream' with linespoints ls 1 linecolor rgb "red", \
        "AdapterStreamInputTests.txt" using ($1 == 4 ? $2 : 1/0):($1 == 4 ? $3 : 1/0) title '4 Stream' with linespoints ls 1 linecolor rgb "yellow", \
        "AdapterStreamInputTests.txt" using ($1 == 8 ? $2 : 1/0):($1 == 8 ? $3 : 1/0) title '8 Stream' with linespoints ls 1 linecolor rgb "brown", \
        "AdapterStreamInputTests.txt" using ($1 == 16 ? $2 : 1/0):($1 == 16 ? $3 : 1/0) title '16 Stream' with linespoints ls 1 linecolor rgb "pink"

set output
Run Code Online (Sandbox Code Playgroud)

我现在的主要问题是它绘制的所有内容都是正确的,但它不会在图之间划线.我在手册 "使用"章节中读到:

应该注意的是,情节'le',使用1:2绘制'le',使用($ 1)绘制'le':( $ 2)可能是微妙的不同:1)如果le有一些列有一列而有些有二,第一个会在缺失时发明x值,第二个会静静地忽略一列的行,第三个会为一个点的行存储一个未定义的值(因此在带有行的图中,没有行连接点跨越坏点); 2)如果一行包含第一列的文本,则第一列将在错误中止图,但第二列和第三列应该静静地跳过垃圾.

我想我是在第三个类别,并且没有线,因为每个情节之间有4个无效的情节,但我找不到任何方法来解决它.

我找不到办法让它忽略无效的情节.并且似乎没有任何我能够找到的预处理方法,可以删除未使用的图.但我可能错过了一些东西.

Azr*_*000 6

那么你有两种选择.

1.)如图所示使用每一个命令在这里,可替换链路(韦巴克机)

2.)使用缺少的参数,如上所述,使用?:符号来添加字符.关于伟大的非官方FAQ,替代链接(回路机器)的更多细节