set rmargin 20
set bmargin 10
set lmargin 17
set xrange [0:10./5.]
set yrange [0:0.99]
set nokey
set key outside
set key spacing 6.5
set key font "Times New Roman, 25"
set xtics font "Times New Roman, 20"
set ytics font "Times New Roman, 20"
f1(x) = a1+b1*x+c1*x*x+d1*x*x*x
f2(x) = a2+b2*x+c2*x*x+d2*x*x*x
f3(x) = a3+b3*x+c3*x*x+d3*x*x*x
f4(x) = a4+b4*x+c4*x*x+d4*x*x*x
f5(x) = a5+b5*x+c5*x*x+d5*x*x*x
f6(x) = a6+b6*x+c6*x*x+d6*x*x*x
f7(x) = a7+b7*x+c7*x*x+d7*x*x*x
fit f1(x) "boundary_1-2.txt" using ($1/5):2 via a1,b1,c1,d1
fit f2(x) "boundary_1-2.txt" using ($1/5):3 via a2,b2,c2,d2
fit f3(x) "boundary_1-2.txt" using ($1/5):4 via a3,b3,c3,d3
fit f4(x) "boundary_1-2.txt" using ($1/5):5 via a4,b4,c4,d4
fit f5(x) "boundary_1-2.txt" using ($1/5):6 via a5,b5,c5,d5
fit f6(x) "boundary_1-2.txt" using ($1/5):7 via a6,b6,c6,d6
fit f7(x) "boundary_1-2.txt" using ($1/5):8 via a7,b7,c7,d7

#plot f7(x) w filledcurve x2 lc rgb "#FFA500" title "k: 8", f7(x) w filledcurve x1 lc rgb "#a9a9a9" title "k: 7", f6(x) w filledcurve x1 lc rgb "#f0e68c" title "k: 6", f5(x) w filledcurve x1 lc rgb "#87CEEB" title "k: 5", f4(x) w filledcurve x1 lc rgb "#FF4C4C" title "k: 4", f3(x) w filledcurve x1 lc rgb "#1E90FF" title "k: 3", f2(x) w filledcurve x1 lc rgb "#00ff7f" title "k: 2", f1(x) w filledcurve x1 lc rgb "#ffaaaa" title "k: 1"

plot f7(x) w filledcurve x2 lc rgb "#FFA500" title "k: 8", f7(x) w filledcurve x1 lc rgb "#a9a9a9" title "k: 7", f6(x) w filledcurve x1 lc rgb "#f0e68c" title "k: 6", f5(x) w filledcurve x1 lc rgb "#87CEEB" title "k: 5", f4(x) w filledcurve x1 lc rgb "#FF4C4C" title "k: 4", f3(x) w filledcurve x1 lc rgb "#1E90FF" title "k: 3", f2(x) w filledcurve x1 lc rgb "#00ff7f" title "k: 2", f1(x) w filledcurve x1 lc rgb "#ffaaaa" title "k: 1", "bridges.txt" using ($1/5):2 w filledcurve x1 lc rgb "#00ff7f" notitle, "bridges-3.txt" using ($1/5):2 w filledcurve x1 lc rgb "#1E90FF" notitle, "bridges-4.txt" using ($1/5):2 w filledcurve x1 lc rgb "#FF4C4C" notitle, "bridges-5.txt" using ($1/5):2 w filledcurve x1 lc rgb "#87CEEB" notitle, "bridges-6.txt" using ($1/5):2 w filledcurve x1 lc rgb "#f0e68c" notitle, "bridges-7.txt" using ($1/5):2 w filledcurve x1 lc rgb "#a9a9a9" notitle,"bridges-8.txt" using ($1/5):2 w filledcurve x1 lc rgb "#FFA500" notitle, f2(x) w filledcurve x1 lc rgb "#00ff7f" notitle, f1(x) w filledcurve x1 lc rgb "#ffaaaa" notitle

#plot f7(x) w filledcurve x2 lc rgb "#FFA500" title "Euler: 8", f7(x) w filledcurve x1 lc rgb "#a9a9a9" title "Euler: 7", f6(x) w filledcurve x1 lc rgb "#f0e68c" title "Euler: 6", f5(x) w filledcurve x1 lc rgb "#87CEEB" title "Euler: 5", f4(x) w filledcurve x1 lc rgb "#DDA0DD" title "Euler: 4", f3(x) w filledcurve x1 lc rgb "#1E90FF" title "Euler: 3", f2(x) w filledcurve x1 lc rgb "#00ff7f" title "Euler: 2", f1(x) w filledcurve x1 lc rgb "#ffaaaa" title "Euler: 1", "bridges.txt" using ($1/5):2 w filledcurve x1 lc rgb "#00ff7f" notitle, "bridges-3.txt" using ($1/5):2 w filledcurve x1 lc rgb "#1E90FF" notitle, "bridges-4.txt" using ($1/5):2 w filledcurve x1 lc rgb "#DDA0DD" notitle, "bridges-5.txt" using ($1/5):2 w filledcurve x1 lc rgb "#87CEEB" notitle, "bridges-6.txt" using ($1/5):2 w filledcurve x1 lc rgb "#f0e68c" notitle, "bridges-7.txt" using ($1/5):2 w filledcurve x1 lc rgb "#a9a9a9" notitle,"bridges-8.txt" using ($1/5):2 w filledcurve x1 lc rgb "#FFA500" notitle, f2(x) w filledcurve x1 lc rgb "#00ff7f" notitle, f1(x) w filledcurve x1 lc rgb "#ffaaaa" notitle

#plot f7(x) w filledcurve x2 lc rgb "#FFA500" title "Euler: 8", f7(x) w filledcurve x1 lc rgb "#a9a9a9" title "Euler: 7", "boundary_1-2.txt" using ($1/5):8 w p pt 9 lt 7 ps 1.5 notitle, f7(x) w l lw 2 lt 7 notitle, f6(x) w filledcurve x1 lc rgb "#f0e68c" title "Euler: 6", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 6 ps 1.5 notitle, f6(x) w l lw 2 lt 6 notitle, f5(x) w filledcurve x1 lc rgb "#87CEEB" title "Euler: 5", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 5 ps 1.5 notitle, f5(x) w l lw 2 lt 5 notitle, f4(x) w filledcurve x1 lc rgb "#DDA0DD" title "Euler: 4", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 4 ps 1.5 notitle, f4(x) w l lw 2 lt 4 notitle, f3(x) w filledcurve x1 lc rgb "#1E90FF" title "Euler: 3", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 3 ps 1.5 notitle, f3(x) w l lw 2 lt 3 notitle, f2(x) w filledcurve x1 lc rgb "#00ff7f" title "Euler: 2", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 2 ps 1.5 notitle, f2(x) w l lw 2 lt 2 notitle, f1(x) w filledcurve x1 lc rgb "#ffaaaa" title "Euler: 1", "boundary_1-2.txt" using ($1/5):2 w p pt 9 lt 1 ps 1.5 notitle, f1(x) w l lw 2 lt 1 notitle, "boundary_1-2.txt" using ($1/5):2 w p pt 9 ps 1.5 lt 1 notitle, "boundary_1-2.txt" using ($1/5):3 w p pt 9 ps 1.5 lt 2 notitle, "boundary_1-2.txt" using ($1/5):4 w p pt 9 ps 1.5 lt 3 notitle, f1(x) w l lw 2 lt 1 notitle, f2(x) w l lw 2 lt 2 notitle, f3(x) w l lw 2 lt 3 notitle, "boundary_1-2.txt" using ($1/5):5 w p pt 9 lt 4 ps 1.5 notitle, f4(x) w l lw 2 lt 4 notitle, "boundary_1-2.txt" using ($1/5):6 w p pt 9 lt 5 ps 1.5 notitle, f5(x) w l lw 2 lt 5 notitle, "boundary_1-2.txt" using ($1/5):7 w p pt 9 ps 1.5 lt 6 notitle, f6(x) w l lw 2 lt 6 notitle, "boundary_1-2.txt" using ($1/5):8 w p pt 9 ps 1.5 lt 7 notitle, f7(x) w l lw 2 lt 7 notitle, "bridges.txt" using ($1/5):2 w p pt 5 lt 2 ps 1.5 notitle, "bridges.txt" using ($1/5):2 w l lt 2 lw 2 notitle, "bridges.txt" using ($1/5):2 w filledcurve x1 lc rgb "#00ff7f" notitle, "bridges-3.txt" using ($1/5):2 w p pt 5 lt 3 ps 1.5 notitle, "bridges-3.txt" using ($1/5):2 w l lt 3 lw 2 notitle, "bridges-3.txt" using ($1/5):2 w filledcurve x1 lc rgb "#1E90FF" notitle, "bridges-4.txt" using ($1/5):2 w p pt 5 lt 3 ps 1.5 notitle, "bridges-4.txt" using ($1/5):2 w l lt 3 lw 2 notitle, "bridges-4.txt" using ($1/5):2 w filledcurve x1 lc rgb "#DDA0DD" notitle, "bridges-5.txt" using ($1/5):2 w p pt 5 lt 3 ps 1.5 notitle, "bridges-5.txt" using ($1/5):2 w l lt 3 lw 2 notitle, "bridges-5.txt" using ($1/5):2 w filledcurve x1 lc rgb "#87CEEB" notitle, "bridges-6.txt" using ($1/5):2 w p pt 5 lt 3 ps 1.5 notitle, "bridges-6.txt" using ($1/5):2 w l lt 3 lw 2 notitle, "bridges-6.txt" using ($1/5):2 w filledcurve x1 lc rgb "#f0e68c" notitle, "bridges-7.txt" using ($1/5):2 w p pt 5 lt 3 ps 1.5 notitle, "bridges-7.txt" using ($1/5):2 w l lt 3 lw 2 notitle, "bridges-7.txt" using ($1/5):2 w filledcurve x1 lc rgb "#a9a9a9" notitle

pause(-1)
pause(-1)