目录
Why gnuplot?
gnuplot helps a lot when we want to produce a pdf file about some graphs or figures.
支持二维和三维图形。它的功能是把数据资料和数学函数转换为容易观察的平面或立体的图形,它有两种工作方式,交互式方式和批处理方式。
install
apt-get install gunplot
How to learn?
with the file following:
Example
Plot
gnuplot> plot sin(x) w l lt 3 lw 2
gnuplot> plot sin(x) w p pt 3 ps 2
gnuplot> plot sin(x) title 'f(x)' w lp pt 3 ps 2 lt 3 lw 2
gnuplot> plot ‘a.dat’ u 2:3 w l lt 3 lw 2 %利用数据文件a.dat中的第二和第三列作图
同时画线
gnuplot> plot sin(x) title ‘sin(x)’ w l lt 1 lw 2, \
cos(x) title ‘cos(x)’ w l lt 2 lw 2
%两条曲线是用逗号隔开的。画多条曲线时,各曲线间均用逗号隔开就可以了
位置控制
gnuplot> set key left %放在左边,有left 和right两个选项
gnuplot> set key bottom %放在下边,只有这一个选项;默认在上边
gnuplot> set key outside %放在外边,但只能在右面的外边
以上三个选项可以进行组合。如:
gnuplot> set key left bottom %表示左下边
还可以直接用坐标精确表示图例的位置,如
gnuplot> set key 0.5,0.6 %将图例放在0.5,0.6的位置处
Reference
[1]http://linux.chinaunix.net/techdoc/develop/2009/07/21/1125242.shtml