X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=research%2FTCS%2Fplot.sh;h=c3d0fea38f2ae3df9d4d6710b2b7ee1f58507398;hb=0217abbb1034188ecbfdf034678cf6867381e561;hp=6727c56517affb3de5015ffd0c3de8f916136446;hpb=54cf7f460c5bb22c8d3dda8296ba1633a71612e1;p=matches%2Fhonours.git diff --git a/research/TCS/plot.sh b/research/TCS/plot.sh index 6727c565..c3d0fea3 100755 --- a/research/TCS/plot.sh +++ b/research/TCS/plot.sh @@ -3,13 +3,13 @@ # Script to plot .dat files x=1 -toplot="3 5" +toplot="3" ylabel="Counts" -style="l" +style="lp" 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) +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 @@ -21,7 +21,16 @@ 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\"" +if [ $2 != "" ]; then + if [ $2 == $1 ]; then + exit 1 + fi + command="set term png size 1024,800; set output \"$2\"" +else + command="" +fi + +command="$command; set title \"$title\"" command="$command; set xlabel \"$xlabel\"" command="$command; set ylabel \"$ylabel\"" command="$command; set key outside right" @@ -37,8 +46,8 @@ done plot=$(echo $plot | sed -e "s/,//$(echo $toplot | wc -w)") command="$command; $plot; exit" - -gnuplot --persist -e "$command" +gnuplot="/usr/bin/gnuplot" +$gnuplot --persist -e "$command"