diff options
author | Nick White <git@njw.name> | 2019-02-25 17:19:48 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-02-25 17:19:48 +0000 |
commit | 0aec35a060a9f9e1e33c18bf0e2af2aafd6a6257 (patch) | |
tree | 06681e52bf515814728e87c3971b50b178d9b480 /pggraph.sh |
Add various helper scripts
Diffstat (limited to 'pggraph.sh')
-rw-r--r-- | pggraph.sh | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/pggraph.sh b/pggraph.sh new file mode 100644 index 0000000..11eb143 --- /dev/null +++ b/pggraph.sh @@ -0,0 +1,24 @@ +#!/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" |