2020年8月7日金曜日

xlookup関数

xlookup(検索キー, 検索キーを探す範囲, 表示したい項目, 0)
index(表示したい項目, match(検索キー, 検索キーを探す範囲, 0))

gnuplot操作方法

  • 基本
    • ディレクトリの変更
                    cd '......
  • 現在のディレクトリの確認
pwd
  • プロット
plot "file_name" u 1:2
「"file_name"の1列目を横軸に、2列目を縦軸にしてグラフを書く」

いくつもプロットしたい場合
plot "file_name" u 1:2,\
"file_name" u 3:4
  • 操作をやめる
unset ...
例) unset xzeroaxis (xゼロの線をやめる)

  • 線の種類
  • 線で結ぶ
w l
  • その他
plot "file" with lp lt 3 lw 2 pt 5 ps 2

lp…linespoints
lt…linetype
lw…linewidth
pt…pointtype
ps…pointsize

postscriptでの点(pointtype)の種類は以下の通り
(参考URL:http://www.proton.jp/apps/gnuplotadjust.html)

  • 縦軸、横軸0の線を入れる
set xzeroaxis
set yzeroaxis
(線の太さなどを指定できる)

  • 軸の範囲
set xrange[0:30]
set yrange[0:25]
  • 目盛の文字を変える
set tics font "フォントタイプ,フォントサイズ"
例) set tics font "Times New Roman,25"
(参考URL:http://detail.chiebukuro.yahoo.co.jp/qa/question_detail/q1012376025)
※ eps color では"Helvetica"を使うこと
  • 軸に名前をつける
           set xlabel "軸の名前"
           set ylabel "軸の名前"
  • 軸の目盛を調整する
           set xtics 1
           set ytics 5
            ※小さな目盛は、
               set mxtics 0.5
               set mytics 1


  • 凡例
  • 凡例の間隔を変える
set key spacing 数字
例) set key spacing 1.5 … 凡例の間隔をデフォルトの1.5倍にする
(参考URL:http://t16web.lanl.gov/Kawano/gnuplot/legend.html)

  • 凡例の位置を変える
set key top left ... 左上
set key top right ... 右上
set key bottom left ... 左下
set key bottom right ... 右下
set key outside . . . 図の右側の外
set key below . . . 図の下側の外
  • 全ての凡例を消す
           unset key
  • 特定の凡例だけ消す
           plot f(x) notitle
  • 凡例のタイトルを変更する
           plot f(x) title "hoge"
  • 図のサイズ
  • 文字を大きくする
        set size 0.7,0.7
  • アスペクト比
set size ratio 正数(縦の長さ/横の長さ)
  • 縦横同じ長さにしたいとき
set size ratio 1
または、
set size ratio square

  • 縦横縮尺を同じにしたいとき
set size ratio -1

  • ファイル出力
  • eps白黒出力
set term postscript
set output "file_name.eps"
rep

  • epsカラー出力
set term postscript enhanced color
set output "file_name.eps"
rep
  • pngカラー出力
set term png
set output "file_name.png"
rep
(参考URL:http://tortoise1.math.ryukoku.ac.jp/wiki/pukiwiki.php?gnuplot#output)

  • 元に戻す
set term windows

  • 使えるterminalを確認
set term