#! /bin/csh -f

set usage = "$0 PROBLEM METHOD..."

set problem = "$1"; shift;
set methods = ( $* )

set tmp = "/tmp/$$.gnuplot"
/bin/rm -f ${tmp}

cat >> ${tmp} <<EOF
set terminal X11
EOF

echo 'set noparametric'  >> ${tmp}

echo 'set title "'${problem}' - path"'  >> ${tmp}
echo 'plot [-1.2:1.2] [-1.2:1.2] \'  >> ${tmp}
echo '  "'${problem}'-cut.plot" using 6:7 with lines \' >> ${tmp}
foreach mth ( ${methods} )
  echo '  , "'${problem}-${mth}.plot'"    using 6:7 with linespoints \' >> ${tmp}
end
echo " " >> ${tmp}
echo 'pause 60' >> ${tmp}

echo 'set title "'${problem}' - f value"' >> ${tmp}
echo 'plot "'${problem}'-cut.plot" using 1:2 with lines \' >> ${tmp}
foreach mth ( ${methods} )
  echo '  , "'${problem}-${mth}.plot'"    using 1:2 with linespoints \' >> ${tmp}
end
echo " " >> ${tmp}
echo 'pause 60' >> ${tmp}

echo 'set title "'${problem}' - f bits"' >> ${tmp}
echo 'plot [ ] [-30:30] "'${problem}'-cut.plot" using 1:3 with lines \' >> ${tmp}
foreach mth ( ${methods} )
  echo '  , "'${problem}-${mth}.plot'"    using 1:3 with linespoints \' >> ${tmp}
end
echo " " >> ${tmp}
echo 'pause 60' >> ${tmp}

echo 'set title "'${problem}' - slope"' >> ${tmp}
echo 'plot "'${problem}'-cut.plot" using 1:4 with lines \' >> ${tmp}
foreach mth ( ${methods} )
  echo '  , "'${problem}-${mth}.plot'"    using 1:4 with linespoints \' >> ${tmp}
end
echo " " >> ${tmp}
echo 'pause 60' >> ${tmp}

echo 'set title "'${problem}' - slope bits"' >> ${tmp}
echo 'plot [ ] [-30:30] "'${problem}'-cut.plot" using 1:5 with lines \' >> ${tmp}
foreach mth ( ${methods} )
  echo '  , "'${problem}-${mth}.plot'"    using 1:5 with linespoints \' >> ${tmp}
end
echo " " >> ${tmp}
echo 'pause 60' >> ${tmp}
echo 'pause 1' >> ${tmp}
echo 'quit' >> ${tmp}

( gnuplot -geometry =500x500+300+200 < ${tmp} )

/bin/rm ${tmp}
exit 0

