代码改变世界

GNUPLOT 学习手记

2012-06-19 09:41  Demote  阅读(1054)  评论(0编辑  收藏  举报

基本操作

  set datafile separator ","    //设置数据文件的分隔符为comma,用于GNUPLOT绘制.csv文件

  set term png          //设置输出图像的格式,还有诸如jpg,eps等

  set output "output.png"    //设置输出到文件

  set xlabel "time"        //设置x坐标为'time'

  set ylabel "block number"    //设置y坐标为'block number'

  set size 0.5,0.5          //长宽均为默认宽度的一半

  plot "input.csv" using 1:5 pt 0  //用input.csv作为输入文件,使用第一列数据做x轴,第5列数据作为y轴,点的类型为0

  (合并多个trace在同一张图上 plot "file1" using _:_ with linespoints linetype 线型 pointtype  点型 linewidth  线宽 pointsize 点宽, file2"........., "file3"........... )

 

点型与线型

  

(转自http://www.tantal.dk/?p=linux/gnuplot)

 

其他相关资源:

not so frequently asked questions http://t16web.lanl.gov/Kawano/gnuplot/index-e.html

GNUPLOT使用技巧 http://linux.chinaunix.net/techdoc/develop/2009/07/21/1125242.shtml

 

附:从文件读取数据文件列表分别绘图脚本

#! /bin/bash
filelist=`cat filelist.txt`
for i in $filelist
do
  gnuplot << eof
  set term png
  set datafile separator ","
  set xlabel "time"
  set ylabel "lbn"
  set size 10,10
  !echo plotting $i
  set output "$i.png"
  plot "$i" using 1:5 with point pointtype 0 pointsize 2
eof
done