我在5.0版中使用 gnuplot ,以便从另一个脚本接收的日志文件中绘制图形。最初,运行一个脚本来创建日志文件,并在同一个脚本内(完成后)通过接收一些命令行参数来执行将绘制图形的新脚本。
绘图图脚本的命令行参数之一(具体为$ 4)是数据(将由plot命令使用)所在的路径。完成执行后:
line 0: warning: Cannot find or open file "/comperative_data.txt"
根本不使用命令行参数。请参阅以下脚本的源代码:
gnuplot<<EOF
set size 1.0,1.0;
set terminal postscript landscape color "Times-Roman" 14 linewidth 2
set timestamp "%d/%m/%y %H:%M"
set key left top Left noreverse enhanced box linetype -1 linewidth 1.000 sample 4 spacing 1 width 0 height 0 autotitles
set grid back lt 0 lw 1
set xlabel "TCP Window Size (Bytes)"
set ylabel "Average Transfer Speed (KiB/s)
set xtics (131072,262144,524288,1048576,2097152,4194304,8388608,16777216,33554432)
set xtics rotate
set logscale x
set format x "%10.f"
set yrange [0:5000000]
set output "$filename"
set title "$title"
fileLocation=system("echo $4/comperative_data.txt")
plot fileLocation using 1:2 title 'Streams_1' with linespoints, fileLocation using 1:3 title 'Streams_2' with linespoints , fileLocation using 1:4 title 'Streams_4' with linespoints , fileLocation using 1:5 title 'Streams_8' with linespoints , fileLocation using 1:6 title 'Streams_16' with linespoints , fileLocation using 1:7 title 'Streams_32' with linespoints , fileLocation using 1:8 title 'Streams_64' with linespoints
EOF