WEB开发网
开发学院操作系统Linux/Unix 使用 gnuplot 在网页中显示数据 阅读

使用 gnuplot 在网页中显示数据

 2010-03-15 00:00:00 来源:WEB开发网   
核心提示: 清单 2. sarx.conf#sarx.confsetterminalpngtruecolorsetoutput"sarimage.png"setautoscalesetxdatatimesettimefmt"%H:%M:%S"setstyledatal

清单 2. sarx.conf

#sarx.conf 
set terminal png truecolor 
set output "sarimage.png" 
set autoscale 
set xdata time 
set timefmt "%H:%M:%S" 
set style data lines 
plot "sarx.txt" using 1:2 title "%user", '' using 1:3 title "%sys" 

图 1. sarimage
使用 gnuplot 在网页中显示数据

查看原图(大图)

绘图选项的表示

在 plot 命令中可以使用缩写。例如,在最初的 plot 命令后面,其他 plot 命令选项都可以缩写,用选项的第一个字母表示。但是,对于本文,我只用缩写表示输入文件,即使用两个单引号表示输入文件 (sarx1.txt)。下面详细解释一下。第一个示例是本文中使用的表示法,第二个示例是缩写表示法,第三个示例是不使用任何缩写的完整命令语句。这三个示例产生相同的输出。

plot "sarx1.txt" using 1:2 title "%user", '' using 1:3 title "%sys" 
 
plot "sarx1.txt" using 1:2 title "%user", '' u 1:3 t "%sys" 
 
plot "sarx1.txt" using 1:2 title "%user",\ 
″sarx1.txt'' using 1:3 title "%sys" 

在向其他用户显示图形时,有时候应该包含明确的标签和标题,以便用户了解数据的意义。为了包含 x 和 y 标签,应该使用 xlabel 和 ylabel 命令并把标签文本放在引号中:

上一页  1 2 3 4 5 6 7 8 9  下一页

Tags:使用 gnuplot 网页

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接