我有一个 csv 文件,每行有 5 个条目。每个条目都是网络数据包是否被触发。每行的最后一项是数据包的大小。每行 = 经过的时间(以毫秒为单位)。
例如行
1 , 0 , 1 , 2 , 117
如何绘制图表,例如其中 x 轴是行号,y 是例如每行中第一个条目的值?
这应该让你开始:
set datafile separator ","
plot 'infile' using 0:1
您还可以使用 gnuplot(免费)绘制到 png 文件:
终端命令
gnuplot> set title '<title>'
gnuplot> set ylabel '<yLabel>'
gnuplot> set xlabel '<xLabel>'
gnuplot> set grid
gnuplot> set term png
gnuplot> set output '<Output file name>.png'
gnuplot> plot '<fromfile.csv>'
注意:您始终需要在此处提供正确的扩展名(此处为 .png)set output
那么输出也可能不是行,因为您的数据没有继续。要解决此问题,只需将“情节”行更改为:
plot '<Fromfile.csv>' with line lt -1 lw 2
更多线条编辑选项(破折号和线条颜色等): http: //gnuplot.sourceforge.net/demo_canvas/dashcolor.html
apt-get install gnuplot
)brew install gnuplot
)获得