#! /bin/bash
plot="set terminal pdfcairo enhanced size 6,4.3 font ', 14';set out 'PreDef16690.pdf';"
plot="$plot set multiplot;"
plot="$plot set obj 1 rect from 16.5, graph 0 to 25.5, graph 1 fc lt -1 fs solid 0.1;"
plot="$plot set arrow 1 from screen 0.41,0.638 to screen 0.102,0.605 filled ls -1 lw 2;"
plot="$plot set arrow 2 from screen 0.579,0.638 to screen 0.85,0.605 filled ls -1 lw 2;"
plot="$plot set size 1,0.4;set origin 0,0.6;set ylabel 'f_{pd}(t_i) [a.u.]';set y2tics 120;set y2range [-260:260];set y2label 'I_{VSt} [A]';set title 'Pre-defined waveform for #16690';set x2tics;set ytics nomirror;unset xtics;set xrange[0.0000:40.0];set yrange[-10:10];plot '< wget -q -O - http://golem.fjfi.cvut.cz/shots/16690/DAS/0513NIturbo_RT.ON/NiData.txt' u (\$1*1000):(\$5*-1) w l lw 2 lc rgb '#ee1500' title '', '< wget -q -O - http://golem.fjfi.cvut.cz/shots/16690/DAS/0513NIturbo_RT.ON/NiData.txt' u (\$1*1000):(\$6*-1/0.005) axis x1y2 w l lw 2 lc rgb '#31ca00' title ''"
plot="$plot ;unset obj 1;set size 1,0.315;set origin 0,0.33;unset x2tics;set y2tics 120;set xtics 1 nomirror;set format x '';set ylabel 'f_{pd}(t_i) [a.u.]';unset arrow 1;set key left bottom;unset arrow 2;unset title;set xrange[16.5:25.5];set yrange[-10:10];plot '< wget -q -O - http://golem.fjfi.cvut.cz/shots/16690/DAS/0513NIturbo_RT.ON/NiData.txt' u (\$1*1000):(\$5*-1) w l lw 2 lc rgb '#ee1500' title 'f_{pd}', '< wget -q -O - http://golem.fjfi.cvut.cz/shots/16690/DAS/0513NIturbo_RT.ON/NiData.txt' u (\$1*1000):(\$6*-1/0.005) axis x1y2 w l lw 2 lc rgb '#31ca00' title 'I_{VSt}'"
plot="$plot ;unset obj 1;set size 1,0.39;set origin 0,0.0;set key bottom right;set format x '%.0f';set xtics mirror;set ylabel '{/Symbol D}_Z [mm]';unset y2label;set y2range[-80:40];set y2tics 30;set rmargin 10.8;set xlabel 't[ms]';set xrange[16.5:25.5];set yrange[-80:40];set ytics 30;plot '16690_dz.txt' u (\$1*1000 + 16.5):(\$2*1000) w l lw 2 lt 1 lc rgb '#200cbc' ti 'vertical plasma position'"
echo $plot | gnuplot
okular PreDef16690.pdf