Automatic commit. Wed Aug 1 14:00:02 WST 2012
authorSam Moore <[email protected]>
Wed, 1 Aug 2012 06:00:02 +0000 (14:00 +0800)
committerSam Moore <[email protected]>
Wed, 1 Aug 2012 06:00:02 +0000 (14:00 +0800)
The lovely woman-child Kaa was mercilessly chained to the cruel post of
the warrior-chief Beast, with his barbarian tribe now stacking wood at
her nubile feet, when the strong clear voice of the poetic and heroic
Handsomas roared, 'Flick your Bic, crisp that chick, and you'll feel my
steel through your last meal!'
-- Winning sentence, 1984 Bulwer-Lytton bad fiction contest.

research/TCS/plot.sh [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index ccc6621..6727c56
@@ -2,22 +2,43 @@
 
 # Script to plot .dat files
 
-title=$(grep "# Title: " $0 | sed 's/# Title: //g')
-labels=$(grep "# Format: " $0 | sed 's/# Format: //g')
-
 x=1
+toplot="3 5"
 ylabel="Counts"
-toplot="2 3 5"
 style="l"
+dir="/home/sam/Documents/University/honours/research/TCS"
+
+title=$(grep "# Title: " $1 | sed 's/# Title: //g')
+comment=$(grep "# Comment:" $1 | sed 's/# Comment: *//1' | head --bytes=100)
+labels=$(grep -A 1 "# Data:" $1 | tail --lines=1 | sed 's/#//1')
+
+if [ "$title" == "" ]; then
+       title=$comment
+else
+       title="$title\n$comment"
+fi
+filename=$(echo $1 | sed -e "s:$dir::g")
+title="$filename\n$title"
 
 xlabel=$(echo $labels | tr " " "\n" | head --lines=$x | tail --lines=1)
 command="set title \"$title\""
 command="$command; set xlabel \"$xlabel\""
 command="$command; set ylabel \"$ylabel\""
-command="$command; plot \"$0\""
-
-for y in toplot; do
-       command="$command 
+command="$command; set key outside right"
+plot="plot "
+for y in $toplot; do
+       lab=$(echo $labels | tr " " "\n" | head --lines=$y | tail --lines=1)
+       if [ "$lab" == "" ]; then
+               lab=$y
+       fi
+       plot="$plot \"$1\" u $x:$y w $style t \"$lab\","
+done
+       
+plot=$(echo $plot | sed -e "s/,//$(echo $toplot | wc -w)")
+command="$command; $plot; exit"
+
+
+gnuplot --persist -e "$command"
 
 
 

UCC git Repository :: git.ucc.asn.au