gnuplotはコマンドライン形式のグラフ描画ツールであり
EPSファイルで出力できるので,TeXに挿入するグラフを作るのに使う
詳しい使い方は説明しないが部分的に書き換えるだけで
すぐにグラフを作れることが目標
用意するものは以下の2種類
gnuplotを起動して,グラフ描画ファイルを読み込めばいい
グラフ描画ファイルが graph.plt である場合は load "graph.plt" である
localhost> gnuplot G N U P L O T Version 3.7 patchlevel 3 last modified Thu Dec 12 13:00:00 GMT 2002 System: SunOS 5.8 Copyright(C) 1986 - 1993, 1998 - 2002 Thomas Williams, Colin Kelley and many others Type `help` to access the on-line reference manual The gnuplot FAQ is available from http://www.gnuplot.info/gnuplot-faq.html Send comments and requests for help to <info-gnuplot@dartmouth.edu> Send bugs, suggestions and mods to <bug-gnuplot@dartmouth.edu> Terminal type set to 'x11' gnuplot> load "graph.plt" gnuplot>
以下,ファイルの内容を説明する
グラフ描画ファイル(graph.plt),データファイル(schemeA.txt, schemeB.txt, schemeC.txt)とする
全てのファイルは同じディレクトリに置いてあるものとする
まず,グラフ描画ファイルの中身について軽く説明し,次に実際に使えるファイル内容を示す
se terminal postscript eps se output "graph.eps" 出力先のEPSファイルの名前 se xlabel "Density(/km/lane)" X軸のラベル se ylabel "loss" Y軸のラベル se key 80,0.3 凡例を置く位置(座標) se xrange [0:100] X軸の値の範囲 se yrange [0:1] Y軸の値の範囲 se grid 罫線をつける se xtics 0, 10, 100 X軸のメモリの間隔 se ytics 0, 0.05, 1 Y軸のメモリの間隔 p "schemeA.txt" t "Scheme A" with linespoints lw 3 pt 7 ps 1.5, "schemeB.txt" t "Scheme B" with linespoints lw 3 pt 4 ps 1.5, "schemeC.txt" t "Scheme C" with linespoints lw 3 pt 3 ps 1.5 ↑"ファイル名" t "凡例に書く名前" with linespoints のセットを線の数だけ並べる(最後まで改行しない) linespoints は点を線でつないだようなグラフの形態 ここまででEPSファイルはできているはず se terminal X11 コンソールでログインしてるときにグラフを表示するための設定 X画面を表示できない場合はエラーが出る replot もう1回同じグラフをプロットする(X画面用)
se terminal postscript eps se output "graph.eps" se xlabel "Density(number/km/lane)" 0,-1 "Times-Roman,30" se ylabel "Time(sec)" -1,0 "Times-Roman,30" se key spacing 1.5 se key 20,20 se xrange [0:100] se yrange [0:100] se grid linewidth 3 se xtics 0, 10, 100 se ytics 0, 10, 100 p "schemeA.txt" t "Scheme A" with linespoints lw 3 pt 7 ps 1.5, "schemeB.txt" t "Scheme B" with linespoints lw 3 pt 4 ps 1.5, "schemeC.txt" t "Scheme C" with linespoints lw 3 pt 3 ps 1.5 set term postscript "Helvetica-Gothic" se terminal X11 replot
3 97.97374691 10 96.63212998 14 95.34785673 16.6 93.57539934 20 91.18008999 24 90.31413032 27 88.6083918 30 87.32865158 33.3 86.03023484 37 83.34358149 40 78.74651655 44 76.3897298 47 72.4505223 50 69.27652778 54 61.36958373 57 55.95430782 60 51.02561325 64 43.94728656 67 37.0479061 70 34.90589185 74 31.51911545 77 27.70778421 80 26.23956746 84 25.85077104 87 25.35726987 90 24.10144018 94 22.97478192 97 22.97797473 100 22.87773694
schemeA.txt と書式は同じ
schemeA.txt と書式は同じ