#! /bin/csh -f
# Last edited on 2008-02-04 20:30:09 by stolfi

set usage = "$0 HISTFILE EPSFILE TITLE"

# Draws a histogram of symbolic curvatures

if ( $#argv != 3 ) then
  echo "usage: ${usage}"; exit 1
endif

set hfile = "$1"; shift
set pfile = "$1"; shift
set title = "$1"; shift

echo "${hfile} -> ${pfile}"

gnuplot <<EOF
# set terminal X11
set terminal postscript eps "TimesRoman" 24
set output "${pfile}"
set boxwidth 1
set size 1.5,0.60
set xrange [-26.75:+26.75]
set yrange [0:6]
# set xlabel "encoded curvature"
set xtics nomirror ( \
  "z" -26, "y" -25, "x" -24, "w" -23, "v" -22, "u" -21, "t" -20, \
  "s" -19, "r" -18, "q" -17, "p" -16, "o" -15, "n" -14, "m" -13, \
  "l" -12, "k" -11, "j" -10, "i" -9, "h" -8, "g" -7, "f" -6, "e" -5, \
  "d" -4, "c" -3, "b" -2, "a" -1, \
  "0" 0,\
  "A" 1, "B" 2, "C" 3, "D" 4, "E" 5, "F" 6, "G" 7, "H" 8, "I" 9, \
  "J" 10, "K" 11, "L" 12, "M" 13, "N" 14, "O" 15, "P" 16, "Q" 17, \
  "R" 18, "S" 19, "T" 20, "U" 21, "V" 22, "W" 23, "X" 24, "Y" 25, "Z" 26 \
)
set ticscale -1
set ylabel "% samples"
set nokey
# set title "${title}"
plot "${hfile}" using 2:4 with boxes
# pause 30
quit
EOF

# /bin/ls -l ${inName}.ps
