감동, 마음이 움직이는 것

[gnuplot] variable파일로부터 받아오기 본문

Tips (Utility, Computer Language, and etc.)

[gnuplot] variable파일로부터 받아오기

Struggler J. 2017. 12. 25. 00:19

set t po eps enh color 40

set border lw 4

y = 2015

set output 'error_'.y.'.eps'

set size 3,3

set multiplot


if (y == "2015") n = 4

if (y == "2000") n = 3

if (y == "1985") n = 2


cmd(m, n) = sprintf("head -%d GammaOpt.txt | tail -1| awk '{print $%d}'", m,  n)

#variable setting

a1 = system(cmd(2, n))

a2 = system(cmd(3, n))

a3 = system(cmd(4, n))

a4 = system(cmd(5, n))

a5 = system(cmd(6, n))

a6 = system(cmd(7, n))

a7 = system(cmd(8, n))

a8 = system(cmd(9, n))

a9 = system(cmd(10, n))


cmd2(m, n) = sprintf("head -%d EatG0.txt | tail -1| awk '{print $%d}'", m,  n-1)

#norm

e1 = system(cmd2(2, n))

e2 = system(cmd2(3, n))

e3 = system(cmd2(4, n))

e4 = system(cmd2(5, n))

e5 = system(cmd2(6, n))

e6 = system(cmd2(7, n))

e7 = system(cmd2(8, n))

e8 = system(cmd2(9, n))

e9 = system(cmd2(10, n))


#사실 아래도 for문 2개를 사용하면 된다.... 여기에는 그냥 적었다.

set size 1,1

set origin 0,2+y0

p './ErrorLandscape_'.y.'_0.txt' u 3:($5/e1) w lp lw 5 lc -1 ps 1 pt 6 t ''


set size 1,1

set origin 1,2+y0

p './ErrorLandscape_'.y.'_1.txt' u 3:($5/e2) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 2,2+y0

p './ErrorLandscape_'.y.'_2.txt' u 3:($5/e3) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 0,1+y0

p './ErrorLandscape_'.y.'_3.txt' u 3:($5/e4) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 1,1+y0

p './ErrorLandscape_'.y.'_4.txt' u 3:($5/e5) w lp lw 5 lc -1 ps 1 pt 6 t ''


set size 1,1

set origin 2,1+y0

p './ErrorLandscape_'.y.'_5.txt' u 3:($5/e6) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 0,0+y0

p './ErrorLandscape_'.y.'_6.txt' u 3:($5/e7) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 1,0+y0

p './ErrorLandscape_'.y.'_7.txt' u 3:($5/e8) w lp lw 5 lc -1 ps 1 pt 6  t ''


set size 1,1

set origin 2,0+y0

p './ErrorLandscape_'.y.'_8.txt' u 3:($5/e9) w lp lw 5 lc -1 ps 1 pt 6  t ''


unset multiplot

reset