gnuplot的入门学习
2D绘图:
最简单的二维作图命令是: plot function
1.例如:简单的画出sin(x),cos(x).
plot sin(x),cos(x)
可以指定函数作图范围:
plot [x1:x2] [y1:y2] function
plot [x1:x2] function (指定 x 范围)
plot [] [y1:y2] function (仅仅指定 y 范围)
注意, 范围设定将会影响以后的作图. 默认作图范围是 x = [-10,10], 键入: set xrange [-10:10]
可以恢复 x 的默认范围值. 键入:set autoscale y
可以恢复 y 的默认范围值. 键入:plot [-5:5] cosh(x)
2.例如:假设只想单看一个正弦函数的周期,我们可以采用“闭”区间的方法得到
set xrange [-pi:pi]
replot cos(x) with points pointtype 2
或 plot [-pi:pi] sin(x), cos(x) with points pointtype 2
3.例如:我们想画出数据文件中的数据
plot sin(x),‘1.dat’
4.例如:命名图和坐标轴
set title 'My first graph'
set xlabel 'shijian'
set ylabel 'lucheng'
plot sin(x)
5.例如:改变轴上的tic,并设置网格,让你的数据可视化
set title "My first graph"
set xrange [-pi:pi] # we want only o