Next Previous Contents

6. 圖形界面

在許多圖形套件中﹐gnuplot 真是其中之翹楚。進入 X Window 後輸入 gnuplot, 可是著讀入兩個範例檔: 2D-data.dat (每行有兩筆資料), 和 3D-data.dat (每行有三筆資料).

例:2-D graphs:

gnuplot> set title "my first graph"
gnuplot> plot '2D-data.dat'
gnuplot> plot '2D-data.dat' with linespoints
gnuplot> plot '2D-data.dat', sin(x)
gnuplot> plot [-5:10] '2D-data.dat'

例:3-D graphs (每一行中的資料以空白鍵最為分隔):

gnuplot> set parametric ; set hidden3d ; set contour
gnuplot> splot '3D-data.dat' using 1:2:3 with linespoints

只有一行資料的檔案(如時間序列)也可以被繪製成 2-D 的圖形:

gnuplot> plot [-5:15] '2D-data-1col.dat' with linespoints

或是繪成 3-D graph :

gnuplot> set noparametric ; set hidden3d
gnuplot> splot '3D-data-1col.dat' using 1 with linespoints

列印圖形:假設您的 Postscript 列表機的指令是 lpr -Pps file.ps﹐步驟如下:

gnuplot> set term post
gnuplot> set out '| lpr -Pps'
gnuplot> replot

然後輸入 set term x11 回復成 x11 模式。 別懷疑﹐當您離開 gnuplot 後﹐文件將會自動列印出來。

更多訊息﹐可輸入 help 或是參見目錄中的範例。 (/usr/lib/gnuplot/demos/


Next Previous Contents