Menu

In time graph the curve is not smooth?

Help
2017-04-17
2017-04-18
  • artiny sixtee

    artiny sixtee - 2017-04-17

    Hy
    I wonder when I working with same code, but the data is only 1 data / 1 second - the code is working,
    But when I change the sensor sample rate to about 30 Hz , so 30 data / 1 second I get this plot:
    http://i.imgur.com/Wn2fbne.jpg

    I want to something like this:
    http://i.imgur.com/GZg5oef.jpg

    the code what i use is this:

    set term png
    set autoscale yfix
    set autoscale xfix 
    set grid
    #set offsets 0,0,30,30
    #set offsets 0,0,30,30
    set offsets graph 0, 0, 50, 50
    
    PATCH = system("cat ./outputs/lastPatch.txt")
    
    
    
    set title "MPU-9150 IMU sensor: RAW Accelerometer "
    set xdata time
    set timefmt '%H:%M:%S'
    set format x '%H:%M:%S'
    set xtics rotate
    set xlabel "[time]"
    set ylabel "[-]"
    #set output "./outputs/IMUrawAccel.png"
    set output sprintf("%sIMUrawAccel.png",PATCH)
    #plot './outputs/IMUrawAccel.txt' using 1:2 title 'X' with lines, './outputs/IMUrawAccel.txt' using 1:3 title 'Y' with lines  , './outputs/IMUrawAccel.txt' using 1:4 title 'Z' with lines   
    plot sprintf("%sIMUrawAccel.txt",PATCH) using 1:2 title 'X' with lines, sprintf("%sIMUrawAccel.txt",PATCH) using 1:3 title 'Y' with lines  , sprintf("%sIMUrawAccel.txt",PATCH) using 1:4 title 'Z' with lines   
    

    And the output of the sensor is this (what I use in gnuplot)

    22:20:59         2704       -1310      -15666   
    
    22:20:59         2886       -1278      -15716   
    
    22:20:59         2860       -1322      -15734   
    
    22:20:59         2844       -1322      -15684   
    
    22:20:59         2854       -1362      -15680   
    
    22:20:59         2834       -1242      -15766   
    
    22:20:59         2864       -1320      -15830   
    
    22:20:59         2836       -1304      -15724   
    
    22:20:59         2882       -1342      -15744   
    
    22:20:59         2888       -1266      -15794   
    
    22:20:59         2940       -1336      -15774   
    
    22:20:59         2866       -1282      -15786   
    
    22:20:59         2860       -1320      -15756   
    
    22:20:59         2810       -1340      -15710   
    
    22:20:59         2858       -1268      -15774   
    
    22:20:59         2870       -1342      -15826   
    
    22:20:59         2868       -1270      -15724   
    
    22:20:59         2822       -1378      -15762   
    
    22:20:59         2922       -1282      -15764   
    ...
    ...
    ...
    
     

    Last edit: artiny sixtee 2017-04-17
    • Edoardo Pasca

      Edoardo Pasca - 2017-04-18

      On Mon, Apr 17, 2017 at 9:40 AM, artiny sixtee artiny@users.sf.net wrote:

      set timefmt '%H:%M:%S'

      I believe the problem is in this line. You are telling gnuplot that the
      time is formatted as hours:minute:second. If it is true,. for 1Hz sampling
      it works fine because you have one reading per second, but anything more
      that that will make 2 or more data points fall on the same time coordinate.

      Edo

      --
      Edo
      I know you think you understand what you thought I said, but I'm not sure
      you realize that what you heard is not what I meant (prob. Alan Greenspan)
      :wq

       
    • Hans-Bernhard Broeker

      Believe it or not, but the plot you got is 100% correct for the data and commands you gave gnuplot to display.

      You asked for a line connecting all the datapoints, but you have 30 datapoints in sequence at the same x coordinate. What other than a vertical line (multiply overpainted) did you expect to get from that?

      If you want a different plot, you'll have to tell gnuplot what else it's supposed to do. I think you're looking for "help smooth unique".

       
  • Martin Neumann

    Martin Neumann - 2017-04-18

    Hallo,

    I also have a problem with the time format. I use the following action. I have two columns with the time information. Colum 1 with the date and Colum 2 with the time. The separator between the columns is a "". I'm trying to get GNUplot reading column 1 & 2 as a colum. But it does not work. I get no warning, but the diagram has only points left and right frame.

    "Date","Time","Alarm 1",....
    "28/02/17","23:58:10"," 0",....
    "28/02/17","23:58:11"," 0",....

    reset
    cd 'c:\000'
    set grid x y
    set datafile separator ","
    set key center top title " "
    set title "Auswertung"
    set xlabel "Zeit"
    set xdata time
    set timefmt "%d/%m/%y"
    set timefmt  "%d/%m/%y,%h:%m:%s"
    set ylabel "el. Leistung [kW]"
    set y2label "TIT [°C]"
    set ytics nomirror
    set y2tics
    set tics out
    set yrange [0.0 : 500.0]
    set ytics 60
    set y2range [000.0 : 500.0]
    plot '01_S01_N.csv' using 1:8 title "el. Leistung" axes x1y1 with points pointtype 5 pointsize 0.5, '01_S01_N.csv' using 1:10 title "TIT" axes x1y2 with points pointtype 5 pointsize 0.5
    
     
    • Hans-Bernhard Broeker

      A note: we would usually prefer that you start your own discussion instead of hijacking someone else's...

      The separator between the columns is a "".

      Not really. It's either a comma, or a double quote, then a comma, then another double quote, depending on which way one looks it.

      gnulot won't just ignore all those " characters while trying to read numeric input (including timefmt data), so you'll have to put those into all your input formats --- or convince the application that created this file not to enclose numeric data as if they were strings.

       
  • Martin Neumann

    Martin Neumann - 2017-04-19

    I´m sorry about that hijacking. Next time I open my own thread.

    The separator is a ,

    If I create a plot without time (e.g. rpm), it works fine. So I think gnuplot ignore it. The files already excist and I can´t delet the double qoutes.

     
  • Martin Neumann

    Martin Neumann - 2017-04-20

    I have it

    "%d/%m/%y,%h:%m:%s" => "%d/%m/%y\",\"%h:%m:%s"

    and it works!

     

Log in to post a comment.

MongoDB Logo MongoDB