Gnuplotによるバッチ作成


Gnuplotによるバッチ作成


1つのディレクトリには30以上の1次元スペクトルファイルがあり、名前はそれぞれS 45202である。01、S45202.02、S45202.03......ファイルごとに図形を描きますが、どうすればいいですか?bash script+gunplotでバッチ処理を行うとすぐにできます。第1の方法:2つのファイル、gnuplotスクリプトファイル、bashスクリプトファイルを作成する:plot.pltファイルset term postscript eps enhanced color set output"S 452002.01.eps"set title"Spectrum"set xlabel"Wavelength[{/Symbol l}]set xtics 5 set ylabel"Intension"set ytics 500 set grid set nokey plot"S 45202.01"using 1:2 with lines batchファイル#!/bin/bash sed "s/S45202.01/S45202.02/g" "plot.plt" | gnuplot sed "s/S45202.01/S45202.04/g" "plot.plt" | gnuplot ... ... ここではsedコマンドを使用します。もっと簡単な方法は #!/bin/bash for i in S45202.* do sed"s/S 45202.01/$i/g""plot.plt"|gnuplot doneの後./batchは各図のeps画像を生成することができます。もっと便利な方法はgnuplotスクリプトとbashスクリプトをファイルに書くことです。/bin/bash for i in S45202.* gnuplot<<EOF set term postscript eps enhanced color set output「$i.eps」set title「Spectrum」set xlabel「Wavelength[{/Symbol}]」set xtics 5 set ylabel「Intension」set ytics 500 set grid set nokey plot「$i」using 1:2 with lines EOF done本稿ではGnuplot-not so Frequently Asked Questionss