这是我的gnuplot digram。我的数据是:
我想创建这个:
这是我的情节剧本:
set terminal png size 900,600 enhanced font "Helvetica,20"
set output 'All recived Packet in the network per second.png'
set grid
set xlabel "Transmision Range"
set ylabel "All of recived Packet in the network per second"
set title "Recive Packet pre second"
plot "NumOfRcvPkt.dat" using 2:3 title 'Transmision Range' with linespoints
此处还有NumOfRcvPkt.dat文件的内容:
0 15 124
1 20 105
2 25 82
答案 0 :(得分:4)
这是通过以下方式实现的:
xmin=14 ; ymin=80
set xrange [xmin:*] ; set yrange [ymin:*]
plot "data" u 2:3 w l lc rgb "red", \
"" u 2:3 w p pt 7 lc rgb "blue", \
"" u (xmin):3:($2-xmin):(0) w vectors nohead lt 2 lc rgb "black", \
"" u 2:(ymin):(0):($3-ymin) w vectors nohead lt 2 lc rgb "black"
前两行设定范围。这很重要,因为您需要知道边缘的位置以绘制黑色虚线。
然后,对于plot
命令,第一行用红线绘制数据,第二行用蓝色圆圈绘制数据,第三行绘制水平黑色虚线,第四行绘制垂直虚线。为了让您的终端接受虚线样式(使用lt 2
选择),您需要添加dashed
,例如set term png dashed
。
结果如下: