#!/usr/bin/gnuplot

# Assign the first argument (ARGV[1]) to a variable
## MOTE: file_to_plot must be set by the caller, eg. 
##    $ gnuplot gnuplot_script -e "file_to_plot='${DATA_FILE}'" > "${LASTFILE}.png"

reset
set terminal png size 760,440
set tmargin at screen 0.88
set rmargin at screen 0.97

set xlabel "runtime (s)"
set ylabel "PID signal (mV)"
set xrange[45:]

set key reverse Left outside
set grid
set style data lines

plot file_to_plot using 1:2 with lines linewidth 2 linecolor rgb "red" notitle, \
  "" using 1:($3) with lines linewidth 1 linecolor rgb "black" notitle, \
  "" using 1:4 with points pointsize 1 pointtype 2 linewidth 3 linecolor rgb "black" notitle, \
  "" using 1:4:5 with labels point offset character 0,character 2 tc rgb "red" notitle
