Search code examples
gnuplot

How to Plot this kind of data in gnuplot?


My data is here --

  0.000              0              0    
  0.001            104             51
  0.002            202            101
  0.003            298            148
  0.0031           290            149
  0.004            289            201
  0.0041           291            209
  0.005            310            250
  0.010            311            260
  0.020            280            240

Now how can I plot this data in Gnuplot? As far as I know, I have to create a dat file. But I am not sure about it.


Solution

  • Well, such basic operation is actually not the idea of StackOverflow. Please consult some tutorial and have a look at the examples on the gnuplot homepage.

    Nevertheless, in short: you don't have to create a file you can provide the data in the code as a datablock.

    Code:

    ### very basic plot from datablock
    reset session
    
    $Data <<EOD
      0.000              0              0    
      0.001            104             51
      0.002            202            101
      0.003            298            148
      0.0031           290            149
      0.004            289            201
      0.0041           291            209
      0.005            310            250
      0.010            311            260
      0.020            280            240
    EOD
    
    plot $Data u 1:2 w lp pt 7, \
           ''  u 1:3 w lp pt 7
    ### end of code
    

    Result:

    enter image description here