#!/bin/bash
# Gnuplot recommends setting the size and origin before going to
# multiplot mode
# This sets up bounding boxes and may be required on some terminals
# create ps and png graph from sgx and sgy files located in $resultDir
# modified script from Guillermo
# Jaroslav Vazny, summer student 2010

. ~/sigmaOpt/bin/var

gnuplot << EOF

set title "Sigma_x plot for $nOfTests Tests" font "Times,24"

#set terminal svg
#set terminal svg  size 700 700 fname "Times" fsize 18
#set output "$resultDir/resultsigma.svg"

set terminal postscript enhanced color 16 eps
set output "$resultDir/resultsigma.ps"




set size 1,0.5

# Done interactively, this takes gnuplot into multiplot mode
# and brings up a new prompt ("multiplot >" instead of "gnuplot >")
set multiplot

# plot the first graph so that it takes a quarter of the screen
set size 0.5,0.5
set origin 0,0.5

set xlabel"Maximum order considered"
set ylabel"S_x [nm] at IP "
p[][39.5:44] "$resultDir/sgx" u 1:(\$3*1e9) axes x1y1  t "S_x " w l


# plot the second graph so that it takes a quarter of the screen
set title "Sigma_y plot for $nOfTests Tests" font "Times,24"

set size 0.5,0.5
set origin 0.5,0.5
set ylabel"S_y [nm] at IP "

p[][0.6:1.5] "$resultDir/sgy" u 1:(\$3*1e9) axes x1y1  t"S_y " w l

#set terminal ps
#set output "$resultDir/resultsigma.ps"
#replot


# On some terminals, nothing gets plotted until this command is issued
unset multiplot

# remove all customization
reset
EOF
