[ Main Page ]

Gnuplot Tips

Gnuplot自体は多くのところで紹介されているので、使用例をいくつか挙げてみる。 ノイズ負荷の模式図を作る時に作った描画。 軸をいじったりする時はunsetコマンドやsetコマンドで設定することになる。

unset yzeroaxis                                                                       
unset xzeroaxis
unset tics
unset key
set sample 500
set border 2

ticsは目盛りを消す、sampleは文字通りサンプル数を増やしてスムーズな描画を行う。

plot [-3.14*2:3.14*2][-1.5:1.5] sin(x)+(rand(0)-0.5)*0.8 \
with lines lw 4 lc rgb "blue", 1.1 \
with lines dt (5,10) lw 4 lc rgb "red" , 0 \
with lines lc black lw 2, sin(x) lc rgb "black" lw 3

plot [-3.14*2:3.14*2][-1.5:1.5] sin(x)+(rand(0)-0.5)*5.0 \
with lines lw 4 lc rgb "blue", 1.1 \
with lines dt (5,10) lw 4 lc rgb "red" , 0 \
with lines lc black lw 2, sin(x) lc rgb "black" lw 3

plot [-3.14*2:3.14*2][-1.5:1.5] sin(x)+(rand(0)-0.5)*0.0 \
with lines lw 4 lc rgb "blue", 1.1 \
with lines dt (5,10) lw 4 lc rgb "red" , 0 \
with lines lc black lw 2, sin(x) lc rgb "black" lw 3

Windows版等だとメニューからEMFの出力等を行えるし、コマンドからepsの出力も行える。

set terminal postscript eps enhanced color
set output "plot.eps" 
replot

Windows版だと、通常のインストールでカレントディレクトリが%USERPROFILE%\Documentsに設定されているので、 マイドキュメントにファイルが出力される。戻すときは、windowsかx11にターミナルを戻せば良い。

set terminal windows
または
set terminal x11
Personally, I'd have a far better time writing scripts if I had some more
creative shells to script in...

ASMsh: The Assembly shell. Commands include MOV, SHL, SHR, JNE, etc.

shellTM: Turing machine shell. Only four commands. Read, write, move left,
move right. Capable of producing any programming language imaginable, given
enough time and nerves of steel.

GeneSH: Four commands. G, A, T, C. Need I say more?

Qsh: Only uses one environment variable, which contains all possible values
simultaneously. Method of scripting: isolate the universe in which the desired
result is already accomplished, and intersect with it.

Of course, I never said they'd be easy to use. But then, if these shells
existed, and I knew a sysadmin who used any of them, you can believe Sysadmin
Day would be a far more celebrated holiday.

The Night Watchman on a Slashdot Comment



Powered by UNIX fortune(6)
[ Main Page ]