#!/bin/sh usage="$0 hocr|prob graph.png" test $# -ne 2 && echo "$usage" && exit 1 t=`mktemp` # TODO: the line_1_ part is changes formatting from hocr line naming to # line numbers. make it work for .prob stuff too. avg-lines -nosort "$1" | awk -F ':' '{printf("%s\t%s\n", $1, $2)}' | sed 's/%//g' | sed 's/[^ ]* line_1_//g' > "$t" gp=`mktemp` printf 'set style data lines\n' >> "$gp" printf 'set title "Line confidences for %s"\n' "$1" >> "$gp" printf 'set xlabel "Line Number"\n' >> "$gp" printf 'set ylabel "Average confidence"\n' >> "$gp" printf 'unset key\n' >> "$gp" printf 'set terminal png truecolor size 1920,1080\n' >> "$gp" printf 'set output "%s"\n' "$2" >> "$gp" printf 'plot "%s"\n' "$t" >> "$gp" printf 'quit\n' >> "$gp" gnuplot "$gp" rm -f "$t" "$gp"