1#!/bin/bash
2WHAT=$1
3DIR=$2
4
5cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot
6
7echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot
8echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot
9echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot
10
11if [ $# > 3 ]; then
12  if [ "$3" == "tiny" ]; then
13    echo "set xrange [2:16]" >> $WHAT.gnuplot
14    echo "set nologscale" >> $WHAT.gnuplot
15  fi
16fi
17
18
19
20DATA_FILE=`cat ../order_lib`
21echo set term postscript color rounded enhanced >> $WHAT.gnuplot
22echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot
23
24# echo set term svg color rounded enhanced >> $WHAT.gnuplot
25# echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot
26# echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot
27
28echo plot \\ >> $WHAT.gnuplot
29
30for FILE in $DATA_FILE
31do
32    LAST=$FILE
33done
34
35for FILE in $DATA_FILE
36do
37    BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
38
39    echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >>  $WHAT.gnuplot
40    if [ $FILE != $LAST ]
41    then
42      echo ", \\" >>  $WHAT.gnuplot
43    fi
44done
45echo " " >>  $WHAT.gnuplot
46
47gnuplot -persist < $WHAT.gnuplot
48
49rm $WHAT.gnuplot
50
51ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf
52convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten  ../${DIR}/$WHAT.png
53
54# pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100  -f plot-svg aat.ps  aat2.svg
55