gnuplot

このページは、gnuplotのメモです。

2011/06/07 Update

関数を描く

plot sin(x) :1次元プロット

splot x**2+y**2 :2次元プロット

データから図を描く

plot "data.txt"

plot "data.txt" using 1:2 (data.txtの1行目, 2行目を使用して描画)

描画オプション

棒グラフ: with boxes

折れ線グラフ: with line

線の太さを変える: linewidth 5 (5倍にする)

点をプロット: with points pointsize 3 pointtype 5

綱掛け: plot (x>=-5 && x<=5 ? 40 : 1/0) with filledcurve y1=0 lt 0 fs solid 0.2 notitle

x軸の描画範囲の指定: set xrange [23:31]

y軸の描画範囲の指定: set yrange [0:60]

両対数軸にする: set logscale

両対数軸を解除する: unset logscale

軸ラベル

x軸を書く: set xlabel "MONTHLY MEAN TEMPERATURE"

y軸を書く: set ylabel "HISTGRAM"

タイトルを書く: set title "KOCHI"

回帰式の当てはめ

f(x)=a*x+b

fit 'data_file' via a,b

この後, 標準出力に係数(ここではa, b)を gnuplot が計算している様子が出る.

また, その出力は 'fit.log' というファイルの名前でも出力されます.

画像出力 (epsで画像を出力)

出力ファイルの指定: set output "image.eps"

出力先をepsに変更: set term postscript eps color "Helvetica-Gothic" 24

参考 Website

gnuplot本家

gnuplotの初歩