#! /bin/bash
# Last edited on 2010-08-15 11:23:17 by stolfilocal

# Plots a graylevel histogram, e.g. for a text and its immediate surround.

title="$1"; shift  # Title for plot
maxval="$1"; shift  # Max value for 
hfile="$1"; shift  # Histogram data file name (IN).
pfile="$1"; shift  # Plot file name (OUT).

gnuplot <<EOF
  set term png truecolor rounded \
    size 400,400 \
    medium \
    xffffff x000000 x404040 \
    xff0000 x009900 x0077ff
  set output "${pfile}"
  set title "${title}"
  set xrange [-0.000001:(${maxval}+0.000001)]
  set yrange [-0.000001:]
  set nokey
  plot "${hfile}" using 1:2 with histeps
  quit
EOF
