LoginSignup
26
23

More than 5 years have passed since last update.

コマンドラインから引数を取る

Posted at

-e で、その後に渡すgnuplotファイルを実行する前に実行すべきコマンドを渡せる。
なのでそこで変数を定義すれば引数っぽく使える。

例えばこんな感じでシェルから file という変数としてデータファイルのパスを渡せば

gnuplot -e "file='some_dir/name_of_file'" test.gp

こうやって任意のデータファイルで図が書ける。

test.gp
set datafile separator ','

# write to PDF
set terminal pdf
set output file.".pdf"

# plot
plot file.".csv" using 3:4 title "data"

例2

複数渡したいときは ; で区切ろう。

gnuplot -e "file='some_dir/name_of_file'; legend='label of data'" test2.gp
26
23
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
26
23