■
perlでデータ処理して、各ファイルごとの図を作って1ページに8個ずつTeXで表示する。
#!/usr/bin/perl # file name: graph.pl # 初期設定 $outputfile = "kakidashi.txt" open(DATA, ">$outputfile"); #gnuplot:epsで書きだすための前書き グラフの大きさ設定 x,yの領域設定 open(SCP,">plotgraph.gp") or die "cannot open graph.gp\n"; print SCP "set term postscript eps enhanced\nset xrange [0:1]\nset yrange[0:1]\nset size 0.5,0.5\n"; #TeX用:プリアンプルその他 open(TXP,">graphview.tex") or die "cannot open graphview.tex\n"; print TXP "\\documentclass{article}\n\\usepackage{graphics}\n\\begin{document}\n\\begin{figure}\n"; print TXP "\\begin{center}\n\\begin{tabular}{cc}\n"; #グラフ数保持の変数の初期化 $graphno=0; #入力ファイルの読み込み while(<>){ #ここでデータ処理:データは一つのファイル「$outputfile」に、空行で区切られたブロックに分けて書きだし。 #グラフ数を増やす $graphno=$graphno+1; #gnuplotスクリプト書きだし。 print SCP "set output \"graph${graphno}.eps\"\nset xlabel \"\"\nset ylabel \"\"\n"; print SCP "plot \"$outputfile\" index $graphno using 2:3 title \"$inputfile\" lt $graphno \n"; #表示用TeX書きだし print TXP "\\resizebox{60mm}{!}{\\includegraphics{graph${graphno}.eps}} "; if($k % 2 == 0){print TXP "\\\\\n";}else{print TXP "&\n";} #グラフ数が1ページの割当8個を越えたら、Tableを閉じる if($graphno>=8){ print TXP "\\end{tabular}\n\\caption{This is figures.}\n\\label{Fig}\n\\end{center}\n" print TXP "\\end{figure}\n\\newpage\n\\begin{figure}\n\\begin{center}\n\\begin{tabular}{cc}\n"; #グラフ数を戻す $graphno=0; } } #各種ファイルの後処理 print TXP "\n\\end{tabular}\n\\caption{This is figures.}\n\\label{Fig}\n\\end{center}\n\\end{figure}\n\\end{document}\n"; close (SCP); close (TXP); close (DATA);