#author("2018-07-06T11:49:40+09:00","","")
#norelated
* gnuplotで2枚のグラフを同時に描画する方法(multiplot) [#sfc4f2fb]
指導書の図4はgnuplotのmultiplot環境で,2枚同時に描かれている.これは次の手順にしたがっている.使用ファイル名や描画範囲(xrange, yrange)は適切に設定すること.
 gnuplot> set multiplot
 multiplot> set size 1,0.5
 multiplot> set origin 0,0.5
 multiplot> set key left
 multiplot> set yrange [-10:10]
 multiplot> set title "Real part of DFT, sin(x)", 103158, Hideyuki Nomura
 multiplot> set xlabel "Sample number"
 multiplot> set ylabel "DFT"
 multiplot> plot "sin_R.dft" with impulses, "sin_R.dft" with points
 multiplot> set size 1,0,5
 multiplot> set origin 0,0
 multiplot> set yrange [-10:10]
 multiplot> set title "Imaginary part of DFT, sin(x)", 103158, Hideyuki Nomura
 multiplot> set xlabel "Sample number"
 multiplot> set ylabel "DFT"
 multiplot> plot "sin_I.dft" with impulses, "sin_I.dft" with points
 multiplot> unset multiplot
最後のunset terminalでmultiplot環境を抜け出します.
#author("2018-07-06T11:56:25+09:00","","")

* multiplot環境でのグラフの保存 [#k18b1d53]
multiplot環境で図の表示が確認されたら,画像として保存します.
ただし,multiplot環境の場合,出力端末(terminal)を途中で変更することはできない.そこで次のような操作を行う.
 gnuplot> set terminal pngcairo
 gnuplot> set output "sample.png"
 gnuplot> set multiplot
 multiplot> set size 1,0.5
 multiplot> set origin 0,0.5
 ...
 multiplot> plot "sin_R.dft" with impulses, "sin_R.dft" with points
 ...
 multiplot> plot "cos_I.dft" with impulses, "cos_I.dft" with points
 multiplot> unset terminal
 multiplot> unset multiplot
これは%%%最初の2行(set terminal ..., set output ...)%%%と%%%最後から2行目(set terminal)%%%のコマンドが追加されています.


トップ   編集 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS