红联Linux门户
Linux帮助
当前位置: 红联Linux门户 > Ubuntu

Linux GnuPlot

发布时间:2008-08-19 21:08:53来源:红联作者:eometry
gnuplot主要用来画曲线图,由于在论文中要用到画图就简单学习了下;以前也学过metapost,不过觉得太复杂了,个人觉得gunplot学习还是挺简单的(比metapost简单) ,好了言归正转先用个例子简单了解下。

1,gunplot安装
本人在ubuntu7.10系统中用系统管理->软件源中直接下载gnuplot软件包。

2,gnuplot的使用
Here is an example: #这是2D图形
###该例子来自于http://www.dcs.shef.ac.uk/~ganglu/personal/TA/mm1simulation.htm

set title "Average Waiting Time in M/M/1 Simulation" #设置图片的标题
set xlabel "Numbers of Packets" #设置横坐标的标签名
set ylabel "Average Waiting Time (s)" #设置纵坐标的标签名
set term png small color #设置图形的保存格式
set output "averagewaitingtime.png" #设置图形的文件名
plot "average_time.dat" t "AverageWaitingTime" with lines

###average_time.dat是图形的数据文件,对于二维图形而言需要两列数据,以空格隔开

###第一列是x轴数据,第二列是y轴数据

###with lines :将相邻的点以线条连接。 如plot sin(x) with lines 。如plot sin(x) with lines 。

###switch t give the legend name

详细讲解请参见:Gnuplot使用手册
文章评论

共有 1 条评论

  1. hongweizhiyuan 于 2009-10-11 09:49:14发表:

    好,非常感谢!

    不过,你没有说安装包在哪?我的是Fedora11,所以可以搜索,其他版本找就不是那么方便了。