我正在使用 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
... ... ...
首先是我使用的流数,其次是缓冲区大小,最后是此操作的时间使用。
我想要一个图表,其中缓冲区大小为 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
我现在的主要问题是它绘制的所有内容都是正确的,但它不会在图之间划线。我在“使用”命令下的手册中读到:
应该注意的是,使用 1:2 绘制 'le'、绘制 'le' 和使用 ($1):($2) 绘制'le' 可能略有不同:1) 如果 le 有一些行只有一列,一些行有第二,第一个将在缺少 x 值时发明它们,第二个将悄悄地忽略具有一列的线,第三个将为具有一个点的线存储一个未定义的值(因此在具有线的图中,没有线连接点穿过坏点);2)如果一行在第一列包含文本,则第一列将在出错时中止绘图,但第二和第三列应该悄悄地跳过垃圾。
我想我在第三类并且没有线条,因为每个情节之间都有 4 个无效情节,但我找不到任何方法来解决它。
我找不到让它忽略无效图的方法。而且似乎没有任何我能找到的预处理方法可以删除未使用的图。但我可能错过了一些东西。