summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bookgraph.sh31
1 files changed, 17 insertions, 14 deletions
diff --git a/bookgraph.sh b/bookgraph.sh
index 8113a5e..a4b1eff 100644
--- a/bookgraph.sh
+++ b/bookgraph.sh
@@ -2,8 +2,8 @@
usage="$0 bookdir
Creates a graph showing the average confidence of each page in a book.
-This relies on the hocr-avgpgconf file being present, which is generated
-by the allpgsconf.sh script"
+This relies on the hocr-avgpgconf and prob-avgpgconf files being present,
+which are generated by the allpgsconf.sh script."
test $# -ne 1 && echo "$usage" && exit 1
@@ -17,18 +17,21 @@ sed 's/_[^\t]*//g' < "$1/hocr-avgpgconf" > "$t"
b=`basename "$1"`
gp=`mktemp`
-printf 'set style data lines\n' >> "$gp"
-printf 'set title "Book Confidence for %s"\n' "$b" >> "$gp"
-printf 'set xlabel "Page Number"\n' >> "$gp"
-printf 'set ylabel "Page confidence"\n' >> "$gp"
-printf 'set mxtics\n' >> "$gp"
-printf 'set terminal png truecolor size 4600,1700\n' >> "$gp"
-printf 'set output "%s"\n' "$1/bookgraph.png" >> "$gp"
-printf 'plot "%s" using 1:2 with lines title "Tesseract",\\\n' "$t" >> "$gp"
-printf ' "" using 1:2:(sprintf("%%d", $1)) with labels point pt 2 notitle,\\\n' >> "$gp"
-printf ' "%s" using 1:2 with lines title "Ocropus",\\\n' "$1/prob-avgpgconf" >> "$gp"
-printf ' "" using 1:2:(sprintf("%%d", $1)) with labels point pt 2 notitle\n' >> "$gp"
-printf 'quit\n' >> "$gp"
+printf '
+
+set style data lines
+set title "Book Confidence for %s"
+set xlabel "Page Number"
+set ylabel "Page confidence"
+set mxtics
+set terminal png truecolor size 4600,1700
+set output "%s"
+plot "%s" using 1:2 with lines title "Tesseract",\\
+ "" using 1:2:(sprintf("%%d", $1)) with labels point pt 2 notitle,\\
+ "%s" using 1:2 with lines title "Ocropus",\\
+ "" using 1:2:(sprintf("%%d", $1)) with labels point pt 2 notitle
+quit
+' "$b" "$1/bookgraph.png" "$t" "$1/prob-avgpgconf" >> "$gp"
gnuplot "$gp"
rm -f "$t" "$gp"