Gnuplot 学习

来源:互联网 发布:为知笔记比印象笔记好 编辑:程序博客网 时间:2024/06/17 06:12

目录

  • 目录
    • Why gnuplot
    • install
    • How to learn
    • Example
      • Plot
      • 同时画线
      • 位置控制
    • Reference

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:

gnuplot_4.6中文手册_修订2

Example

Plot

gnuplot> plot sin(x) w l lt 3 lw 2gnuplot> plot sin(x) w p pt 3 ps 2gnuplot> plot sin(x) title 'f(x)' w lp pt 3 ps 2 lt 3 lw 2gnuplot> 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

0 0
原创粉丝点击