Plotting using a CSV file

后端 未结 2 2053
余生分开走
余生分开走 2021-01-31 06:56

I have a csv file which has 5 entries on every row. Every entry is whether a network packet is triggered or not. The last entry in every row is the size of packet. Every row = t

相关标签:
2条回答
  • 2021-01-31 07:40

    This should get you started:

    set datafile separator ","
    plot 'infile' using 0:1
    
    0 讨论(0)
  • 2021-01-31 07:50

    You can also plot to a png file using gnuplot (which is free):

    terminal commands

    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>'
    

    note: you always need to give the right extension (.png here) at set output

    Then it is also possible that the ouput is not lines, because your data is not continues. To fix this simply change the 'plot' line to:

    plot '<Fromfile.csv>' with line lt -1 lw 2
    

    More line editing options (dashes and line color ect.) at: http://gnuplot.sourceforge.net/demo_canvas/dashcolor.html

    • gnuplot is available in most linux distros via the package manager (e.g. on an apt based distro, run apt-get install gnuplot)
    • gnuplot is available in windows via Cygwin
    • gnuplot is available on macOS via homebrew (run brew install gnuplot)
    0 讨论(0)
提交回复
热议问题