[ 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
Chuck Norris is his own boss. If you hire him, he'll tell your boss what to
do.

    -- Shlomi Fish
    -- Chuck 
                      Norris Facts by Shlomi Fish ( http://www.shlomifish.org/humour/bits/facts/Chuck-Norris/ )

"A witty saying proves nothing." --
Voltaire

	-- One of Nadav Har'El's Email Signatures.


Powered by UNIX fortune(6)
[ Main Page ]