我有一个csv文件,每行有5个条目.每个条目都是网络数据包是否被触发.每行的最后一个条目是数据包的大小.每行=以ms为单位的经过时间.
例如排
1 , 0 , 1 , 2 , 117
Run Code Online (Sandbox Code Playgroud)
如何绘制图形,例如x轴是行号,y是每行第一个条目的值?
Tho*_*hor 81
这应该让你开始:
set datafile separator ","
plot 'infile' using 0:1
Run Code Online (Sandbox Code Playgroud)
Oli*_*li4 17
您还可以使用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>'
Run Code Online (Sandbox Code Playgroud)
注意:你总是需要给出正确的扩展名(.png) set output
然后,输出也可能不是行,因为您的数据不会继续.要解决此问题,只需将"plot"行更改为:
plot '<Fromfile.csv>' with line lt -1 lw 2
Run Code Online (Sandbox Code Playgroud)
更多行编辑选项(破折号和线条颜色等):http: //gnuplot.sourceforge.net/demo_canvas/dashcolor.html
apt-get install gnuplot)brew install gnuplot)