# Script to plot .dat files
x=2
-toplot="3 5"
+toplot="3"
ylabel="Counts"
style="p"
dir="/home/sam/Documents/University/honours/research/TCS"
title="$filename\n$title"
xlabel=$(echo $labels | tr " " "\n" | head --lines=$x | tail --lines=1)
-if [ $2 != "" ]; then
- if [ $2 == $1 ]; then
+if [ "$2" != "" ]; then
+ if [ "$2" == "$1" ]; then
exit 1
fi
command="set term png size 1024,800; set output \"$2\""
command="$command; set xlabel \"$xlabel\""
command="$command; set ylabel \"$ylabel\""
command="$command; set key outside right"
+#command="$command; set yrange [0:1]"
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\","
+ plot="$plot \"$1\" u $x:$y w $style t \"$1\","
done
-
plot=$(echo $plot | sed -e "s/,//$(echo $toplot | wc -w)")
+
+if [ "$3" != "" ]; then
+ plot="$plot, \"$3\" u $x:$y w $style t \"$3\""
+fi
+
+
command="$command; $plot; exit"
gnuplot="/usr/bin/gnuplot"