view · edit · attach · print · history

學習GNUPlot


GNUPlot的大本營

其它的中文資料


下載、安裝與執行GNUPlot

  • Windows平臺
    • 下載GNUPlot 4.0版:
    ftp://ftp.gnuplot.info/pub/gnuplot/gp400win32.zip
    • 安裝
    將gp400win32.zip解壓之後, 會產生一個gnuplot資料夾
    • 啟動
    1.打開gnuplot資料夾後, 再打開bin這個資料夾。
2.執行wgnuplot_pipes.exe這個程式後,會出現如下圖所顯示的視窗, 就代表您可以開始使用GNUPlot了!

開始使用GNUPlot

  • 畫出第一個圖形
    • 以y=sin(x)為例
    在gnuplot視窗中, 在gnuplot> 命令提示符號後輸入下列指令。
    plot sin(x), 按[Enter]鍵。
此時會出現一個新的視窗, 標題為gnuplot graph。出現的內容即為y=sin(x)的圖形。
  • 把畫出的圖形輸出成一個圖形檔
呈接上個主題。在gnuplot> 命令提示符號後輸入下列指令。
set term png size 640,480, 按[Enter]鍵。
set output 'sin.png', 按[Enter]鍵。
replot, 按[Enter]鍵。
此時會在bin這個資料夾中, 出現一個名為sin.png的檔案。如下圖所示:
  • 說明:
1.在這個例子中, 我們使用plot這個指令來繪製數學函式圖形y=sin(x)。
2.然後, 利用set term png size 640,480將終端模式(terminal)改為PNG格式。且圖形大小為640x480。
3.緊接著, 利用set output 'sin.png',使輸出結果寫入sin.png圖形檔中。當然, 您可以自己命名其它的檔名, 例如: 如果要輸出到plots.png圖形檔中, 則利用set output 'plots.png'
4.在還沒執行replot之前, 上一動作所設定的圖形檔是空的。執行replot之後, 才會將剛才出現在視窗中的圖形寫到圖形檔中。

view · edit · attach · print · history · 1468
Page last modified on 2005年08月26日 PM 12:12