X is invalid GNUplot time and date

I am trying to plot the data I am getting from dataloggers and I am not sure why I am getting xrange - it is not the correct error.

Below is my minimal script and sample data I am trying to plot. They all have similar titles that I thought were the problem, but I tried commenting out or removing them and it didn't work. If the solution could include a way to do it without messing around with headers, that would be great and save a lot of time.

I changed the headers to just the letter A for data protection, this gives the same error.

Minimum code

    #!/gnuplot

set datafile sep ','
set xdata time
set timefmt '%d/%m/%Y,%H:%M:%S'



#DATA FILES
plot 'PAS.csv'   using 2:4 title 'Passive'  with points pt 5 lc rgb 'red'   axes x1y1,\
     'ACT.csv'   using 2:4 title 'Active'   with points pt 5 lc rgb 'blue'  axes x1y1,\
     'RISK.csv'  using 2:4 title 'Risk'     with points pt 5 lc rgb 'black' axes x1y2

      

DATA

AAAAAAAAA   
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

Timestamp,Date,Time,Value,Units  
1415879007,13/11/2014,11:43:27,0.011,µA 
1415878407,13/11/2014,11:33:27,0.045,µA 
1415877807,13/11/2014,11:23:27,0.003,µA
1415877207,13/11/2014,11:13:27,0.056,µA
1415876607,13/11/2014,11:03:27,-0.036,µA
1415876007,13/11/2014,10:53:27,-0.046,µA 
1415875407,13/11/2014,10:43:27,-0.039,µA 
1415874807,13/11/2014,10:33:27,-0.050,µA 
1415874207,13/11/2014,10:23:27,0.051,µA 
1415873607,13/11/2014,10:13:27,-0.014,µA 
1415873007,13/11/2014,10:03:27,0.035,µA 
1415872407,13/11/2014,09:53:27,0.054,µA 
1415871807,13/11/2014,09:43:27,-0.006,µA 
1415871207,13/11/2014,09:33:27,-0.049,µA 
1415870607,13/11/2014,09:23:27,0.000,µA 
1415870007,13/11/2014,09:13:27,0.048,µA 
1415869407,13/11/2014,09:03:27,-0.029,µA

      

Thank!

+3


source to share


1 answer


If you have access to a command line tool, for example grep

, you can filter your data file before printing it:

set datafile sep ','
set xdata time
set timefmt '%d/%m/%Y,%H:%M:%S'

#DATA FILES
plot '< grep -E ''^[0-9]{8,}'' PAS.csv' using 2:4 title 'Passive' with points pt 5 lc rgb 'red'

      

This removes all lines that do not start with at least eight digits. Tested to work with 4.6.3.



Alternatively, if the older version of gnuplot has comma issues inside timefmt

, you can also use the timestamp in the first column for the x-axis:

set datafile sep ','
set xdata time
set timefmt '%s'
plot '< grep -E ''^[0-9]{8,}'' PAS.csv' using 1:4 title 'Passive' with points pt 5 lc rgb 'red'

      

+4


source







All Articles