4
votes

I would like to plot data with x data as a time value. The csv file looks as following

"","12/09/29","00:19:43","  1787","    12","12"
"","12/09/29","00:19:48","  1787","    12","12"
"","12/09/29","00:19:53","  1785","    13","12"
"","12/09/29","00:19:58","  1785","    12","12"

The problem here is the usage of the double quote. I tried this

set timefmt '"%y/%m/%d","%H:%M:%S"'
set datafile separator ","
plot 'myFile.csv' using 2:3:4 with lines

but it doesn't recognize the time format.

How can I recognize the time value from two separated column, with double quote and comma separator?

Thank you for your help.

thomas

1

1 Answers

2
votes

If quotes are the problem, and you're on a posix system with pipes enabled, you can easily remove them:

plot '< sed -e s/\"//g test.dat' using 2:4:5

Note that the using specification also changed (2:4:5 instead of 2:3:4) since your timeformat takes 2 columns.


Note that I do not think that the quotes are problematic:

set datafile sep ','
set xdata time
set timefmt '%y/%m/%d,%H:%M:%S'  #no quotes in timefmt -- Gnuplot removes them when parsing the datafile.
plot 'test.dat' using 2:4:5 with lines

works for me.

So I really think that the problem was your using specification pointing at the third column (which contains time information) instead of the fourth. Finally, you can make the same plot with using 2:4 -- You never actually use the 5th column for anything here.