Gnuplot科学绘图 系列内容Gnu plot科学绘图(三十六)——统计直方图
Gnuplot科学绘图(三十七)——三元算符和分段函数
Gnuplot科学绘图(三十八)——几何图形对象
Gnuplot科学绘图(三十九)——地图及圆圈数据图
作为一个具有脚本编程能力的命令行程序,循环语句是必不可少的。gnuplot 具有和 C 语言类似的 for 循环结构,可以应用于 plot, splot, set 和 unset 命令。for 命令的基本结构是:
for [i = begin:end:step]
这表示 i 的取值从 begin 到 end,步长为 step。如果步长为 1,step 也可以省略。下面举例说明:
gnuplot> f(x,s) = exp(-x*x/(2.*s))/(sqrt(2*pi*s))
gnuplot> set term wxt enhanced
gnuplot> set title "Normal Distribution"
gnuplot> set samples 1000
gnuplot> set style fill transparent solid 0.3 noborder
gnuplot> plot for [i=1:10:3] f(x,i) w filledcurves title "σ^2 = ".i