gnuplot / plot (2)
not so FAQ
|
2次元プロットのあれこれ (その2)X=0, Y=0のゼロ軸を描きたい. set {x|y}zeroaxis を使います.オプションを付けなければ, gnuplot> set xzeroaxis lt -1 gnuplot> set yzeroaxis ![]() 誤差棒の先に付く横線を消したい.誤差付きのプロットをすると,誤差棒の先に小さな線が入ります. gnuplot> set bar 0 barの後の数字で線の長さを指定します.0にすれば線は表示されません. なお, set pointsize で記号の大きさを変えても,この線の長さ gnuplot> set pointsize 3 gnuplot> set bar 3 文字を大きくしたい. 文字を大きくできるかどうかは,図を出力しようとしているデバイスに依 出力をPostScriptにするなら,比較的簡単に文字を大きくできます.文字 gnuplot> set size 0.3,0.3 少々極端な例ですが,上のように図の大きさを縦横30%にしておきます. 同じくPostScript出力にてフォントを細かく指定したいならlabelやtitleの gnuplot> set terminal postscript enhanced "Helvetica" 16 gnuplot> set title "Damping Function" font "Times-Roman,40" gnuplot> set xlabel "X-AXIS" font "Helvetica,20" gnuplot> set ylabel "Y-AXIS" font "Times-Italic,32" gnuplot> plot exp(-x) ![]() ただ,上にも書いていますが,gnuplotでここまで面倒なことをやる必要が データ点の間を滑らかな曲線で補間したい. gnuplotには3次のSpline補間等によってデータ間を補間する機能がありま 次の例では,3次スプラインとベジエでの補間を比較しています.データ gnuplot> plot "test.dat" using 1:2 notitle with points, > "test.dat" using 1:2 smooth csplines > title "spline" with lines, > "test.dat" using 1:2 smooth bezier > title "bezier" with lines ![]() スプライン関数のオプション csplines gnuplot> plot "test.dat" using 1:2:3 notitle with yerrorbars, > "test.dat" using 1:2:3 smooth acsplines > title "acsplines" with lines, > "test.dat" using 1:2 smooth bezier > title "bezier" with lines ベジエ曲線は,データの変化をかなり追随していますが,スプラインでは, スプラインによる近似曲線ではデータ点の重みが必要ですが,全データに 枠線上にあるデータ点を消したい. 枠線近くにあるデータや線分は,枠からはみ出さない様に切り取る(クリッ # X Y 1.0 1.0 2.0 1.5 3.0 2.0 4.0 1.5 5.0 1.0 このデータを普通にpointsを使って表示すると,最初の点(X=1)と最後の点 gnuplot> set pointsize 10 gnuplot> plot "test.dat" notitle with points この例の様に,特に大きな記号で図を描いた場合は,枠上の点が煩わしくなります. gnuplot> set clip points gnuplot> plot "test.dat" notitle with points クリップを指定した場合で,X=1,3,5でのデータが消えています.実は,デー クリップの次のタイプは set clip one 「枠線と交わる線分」というのが分かりにくいかもしれません.gnuplot y=sin(x)を使い,Yの範囲を[0:1]にして表示してみましょう.このとき,グラ gnuplot> set clip one gnuplot> plot sin(x) with linespoints gnuplot> set noclip one gnuplot> replot
最後のクリップは set clip two です.これは clip oneの場合 gnuplot> set yrange [-0.5:0.5] gnuplot> set samples 10 gnuplot> set clip two gnuplot> plot sin(x) with linespoints gnuplot> set noclip two gnuplot> replot
上の例のようにサンプリング数を極端に少なくすると,線分によっては, |