#! /bin/bash 
# Last edited on 2010-10-07 16:32:51 by stolfilocal

NP="$1"; shift

temp="/tmp/$$"
infile="${temp}.txt"
outfile="${temp}.png"

cat > ${infile}

gnuplot <<EOF
  set term png size 640,320 large
  set output "${outfile}"
  set xrange [-0.5:(${NP}-1+0.5)]
  set yrange [0.0001*0.99:10.0/0.99]
  set logscale y
  set nokey
  set zeroaxis
  plot "${infile}" using 1:(column(2)**2) with linespoints
  quit
EOF

cat ${outfile}

rm -f ${temp}.*

