Reputation: 45
I have a dataset with columns separated by spaces. The columns are ' year month day hour data ' in this order.
I have tried several time formats such as "%Y%m%d%H", "%Y%m%d%k", "%Y %m %d %k" but they don't work. I think it is because the columns change the number of digits.
Which is the appropiate time format for this kind of data?
Here's an example of the data set.
2002 12 31 9 65
2002 12 31 10 60
2002 12 31 11 56
2002 12 31 12 50
2002 12 31 13 45
2002 12 31 14 38
2002 12 31 15 45
2002 12 31 16 50
2002 12 31 17 47
2002 12 31 18 44
2002 12 31 19 40
2002 12 31 20 32
2002 12 31 21 35
2002 12 31 22 40
2002 12 31 23 33
2003 1 1 0 28
2003 1 1 1 25
And here's my code:
set xdata time
set timefmt "%Y%m%d%k"
plot "datafile.dat" using 1:2
set terminal png enhanced
set output "series.png"
replot
Upvotes: 3
Views: 619
Reputation: 48390
Having spaces in you date is fine, you must only count the column properly: your data is in the fifth column, no matter how many columns are consumed by the timefmt:
set xdata time
set timefmt "%Y %m %d %H"
plot "datafile.dat" using 1:5
And a single space in the timefmt matches one or more white spaces in the data.
Upvotes: 2