set terminal epslatex size 3.5,1.45
set output "error_dist_nexus.tex"
set key samplen 1.0 spacing 0.8 width -5

set lmargin 4.7
set tmargin 0.3
set rmargin 1.2
set bmargin 1.2

# the first 20 values (= 10 seconds) are skipped using "tail"

simpleFiles="data/err_bergwerk_path1_nexus_simple.dat data/err_bergwerk_path2_nexus_simple.dat data/err_bergwerk_path3_nexus_simple.dat data/err_bergwerk_path4_nexus_simple.dat"
simpleInput=sprintf("%s%s%s", "< tail -n+20 -q ", simpleFiles, " | sort -g");
simpleLines=system(sprintf("%s%s%s", "tail -n+20 -q ", simpleFiles, " | wc -l"));

multiFiles="data/err_bergwerk_path1_nexus_multi.dat data/err_bergwerk_path2_nexus_multi.dat data/err_bergwerk_path3_nexus_multi.dat data/err_bergwerk_path4_nexus_multi.dat"
multiInput=sprintf("%s%s%s", "< tail -n+20 -q ", multiFiles, " | sort -g");
multiLines=system(sprintf("%s%s%s", "tail -n+20 -q ", multiFiles, " | wc -l"));

shortFiles="data/err_bergwerk_path1_nexus_shortest.dat data/err_bergwerk_path2_nexus_shortest.dat data/err_bergwerk_path3_nexus_shortest.dat data/err_bergwerk_path4_nexus_shortest.dat"
shortInput=sprintf("%s%s%s", "< tail -n+20 -q ", shortFiles, " | sort -g");
shortLines=system(sprintf("%s%s%s", "tail -n+20 -q ", shortFiles, " | wc -l"));

#set xrange[0:14]
set key left
set format x "\\footnotesize{%.0f m}"
set format y "\\footnotesize{%.0f \\%%}"


plot \
	simpleInput using ($1/100):($0/simpleLines*100) with lines title "\\footnotesize{simple}" lw 1.2 lc rgb "#000000", \
	multiInput using ($1/100):($0/multiLines*100) with lines title "\\footnotesize{multi}" lw 1.2 lc rgb "#0000cc", \
	shortInput using ($1/100):($0/shortLines*100) with lines title "\\footnotesize{shortest}" lw 1.2 lc rgb "#cc0000", \
