gnuplot / misc (4)
not so FAQ
|
その他もろもろ (その4)多くの線種を使う図 一つの図の中に沢山の線をひき,それらを区別したい場合があります.し 種類 (実線・点線・一点鎖線等) 太さ (細線・太線) 色 線と記号の同時表示 terminalによっては点線が描けなかったり,太さが変えられなかったりし 表示する線の種類を指定するために, set linestyle で予めい gnuplot> set term postscript eps enhanced gnuplot> set linestyle 1 lt 1 lw 1 gnuplot> set linestyle 2 lt 2 lw 1 gnuplot> set linestyle 3 lt 3 lw 1 gnuplot> set linestyle 4 lt 6 lw 1 gnuplot> set linestyle 5 lt 1 lw 3 gnuplot> set linestyle 6 lt 2 lw 3 gnuplot> set linestyle 7 lt 3 lw 3 gnuplot> set linestyle 8 lt 6 lw 3 gnuplot> set xrange [-pi:pi] gnuplot> plot sin( x) w l ls 1, sin(2*x) w l ls 2, sin(3*x) w l ls 3, sin(4*x) w l ls 4, cos( x) w l ls 5, cos(2*x) w l ls 6, cos(3*x) w l ls 7, cos(4*x) w l ls 8 ![]() 線種を変えればもう少し多くの線を区別して表示することが可能ですが, 描こうとしている図にもよりますが,実用的には10種類程度の線種を混ぜ ![]() 上に書いてある「線と記号の同時表示」とは,線に重ねて記号を表示する gnuplot> set linestyle 1 lt 1 lw 3 pt 5 gnuplot> set linestyle 2 lt 1 lw 3 pt 6 このように線と記号の種類を同時に定義しておき,プロットする際に 最小自乗法で得られたパラメータ数値を図に書き込む 最小自乗fitを行って得られたパラメータの数値を,図のラベルとして書き込みます. gnuplot> f(x)=a*x*x+b*x+c gnuplot> fit f(x) 'test.dat' using 1:2:3 via a,b,c gnuplot> set label 1 "Y=AX^2+BX+C" at 11,1225 gnuplot> set label 2 "A = %g", a at 12,1200 gnuplot> set label 3 "B = %g", b at 12,1180 gnuplot> set label 4 "C = %g", c at 12,1160 gnuplot> plot f(x),'test.dat' using 1:2:3 with yerr ![]() from Joerg in Switzerland. Thanks !
|