#!/bin/bash
#set -x

SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"

cat >plots.gnu <<EOF

set datafile separator ","
set title "polyplot"
set ylabel "y"
set xlabel "x"
set xzeroaxis
#set xrange [-8000:5000]
#set yrange [0:40]
#set grid xtics ytics
set size ratio 0.71
set terminal pdf size 26.7cm, 19cm
set output "polyplot.pdf"
#set terminal x11
#set terminal svg size 1000, 600 dynamic
#set output "plot.svg"
#f(x) = (((-2.5486772e-10*x - 7.1126416e-7)*x + 8.4959053e-3)*x +3.359595)*x + 665.17485 - 16580

set xrange [   -48567:   -22167]
set arrow from  -35343.68,graph(0,0) to  -35343.68,graph(1,1) nohead
f(x) = ((((+3.52817500e-16)*x+4.87306492e-11)*x+2.40004712e-6)*x+4.93417910e-2)*x+3.46128206e2
plot f(x) with points,"-" with points
   -22167,  -14.00
   -48567,   -9.00
   -47367,   -9.00
   -46167,   -8.00
   -44967,   -8.00
   -43767,   -7.00
   -42567,   -5.00
   -41367,   -4.00
   -40167,   -4.00
   -38967,   -3.00
   -37767,   -2.00
   -36567,   -1.00
   -35367,    0.00
   -34167,    0.00
   -32967,   -1.00
   -31767,   -2.00
   -30567,   -3.00
   -29367,   -5.00
   -28167,   -7.00
   -26967,   -9.00
   -25767,  -10.00
   -24567,  -11.00
   -23967,  -12.00
   -23367,  -13.00
e

#pause -1 "$filename"
EOF

gnuplot plots.gnu

#rm -f [ls]k.dat
