plot: add gnuplot 5 support
[fio.git] / tools / plot / graph2D.gpm
index 2d0d30ad002384a433876eca087707728ac5a53d..769b754a05bbdbcb4540fc9861264803838a9d23 100644 (file)
@@ -1,18 +1,39 @@
 # This Gnuplot file has been generated by eNovance
 
-set title '$0'
+needed_args = 8
+if (exists("ARGC") && ARGC >= needed_args) \
+       found_args = 1; \
+else if (strlen("$$#") < 3 && "$#" >= needed_args) \
+       found_args = 1; \
+       ARG1 = "$0"; \
+       ARG2 = "$1"; \
+       ARG3 = "$2"; \
+       ARG4 = "$3"; \
+       ARG5 = "$4"; \
+       ARG6 = "$5"; \
+       ARG7 = "$6"; \
+       ARG8 = "$7"; \
+else \
+       found_args = 0; \
+       print "Aborting: could not find all arguments"; \
+       exit
+
+avg_num = ARG8 + 0
+avg_str = sprintf("%g", avg_num)
+
+set title ARG1
 
 set terminal png size 1280,1024
-set output '$3.png'
+set output ARG4 . '.png'
 #set terminal x11
 
 #Preparing Axes
 #set logscale x
-set ytics axis out
+set ytics axis out auto 
 #set data style lines
 set key top left reverse
 set xlabel "Time (Seconds)"
-set ylabel '$4'
+set ylabel ARG5
 set xrange [0:]
 set yrange [0:]
 
@@ -22,13 +43,13 @@ set yrange [0:]
 set style line 100 lt 7 lw 0.5
 set style line 1 lt 1 lw 3 pt 3 linecolor rgb "green"
 
-plot '$1' using 2:3 with linespoints title '$2', $7 w l ls 1 ti 'Global average value'
+plot ARG2 using 2:3 with linespoints title ARG3, avg_num w l ls 1 ti 'Global average value (' . avg_str . ')'
 
-set output '$5.png'
-plot '$1' using 2:3 smooth csplines title '$2', $7 w l ls 1 ti 'Global average value'
+set output ARG6 . '.png'
+plot ARG2 using 2:3 smooth csplines title ARG3, avg_num w l ls 1 ti 'Global average value (' . avg_str . ')'
 
-set output '$6.png'
-plot '$1' using 2:3 smooth bezier title '$2', $7 w l ls 1 ti 'Global average value'
+set output ARG7 . '.png'
+plot ARG2 using 2:3 smooth bezier title ARG3, avg_num w l ls 1 ti 'Global average value (' . avg_str .')'
 
 #pause -1
 #The End