Reputation: 673
I have a csv file that looks like:
1,Fri Jun 27 23:22:17 2014
...
3500,Sat Jun 28 09:21:55 2014
I want to plot column 1 as y and column 2 as x:
set datafile separator ","
set xdata time
set timefmt "%a %b %d %T %Y"
set format x "%d-%b\n%H:%M"
plot "file.csv" u 2:1
For every line I get an error:
warning: Bad time format in string
warning: Bad abbreviated month name
warning: Skipping data file with no valid points
And at the end x range is invalid
I really do not know what is going on. My time format looks good. Right? Thanks!
Upvotes: 2
Views: 2802
Reputation: 13087
Gnuplot does not support the %a
, %T
specifiers in timefmt
(nevertheless, they can be used in set format x
) - see p. 168 in the documentation.
While %T
can be directly replaced with %H:%M:%S
, %a
might seem a bit problematic. A workaround would be to preprocess the file in order to get rid of the day name in the second column, e.g.
set xdata time
set timefmt "%b %d %H:%M:%S %Y"
set format x "%d-%b\n%H:%M"
plot "<(gawk -F, '{print $1, substr($2, 5)}' file.csv)" u 2:1
Note that since the file was preprocessed by gawk
, the command set datafile separator ","
is no longer needed here.
Upvotes: 3