Reputation: 387
I've got a data file with thousands of lines like so:
Sat_May_25_09:38:22_2013 9
Sat_May_25_09:38:35_2013 2
Sat_May_25_09:38:55_2013 2
Sat_May_25_09:39:30_2013 2
Sat_May_25_09:40:25_2013 2
Sat_May_25_09:41:21_2013 2
Sat_May_25_09:42:16_2013 2
Sat_May_25_09:43:11_2013 2
Sat_May_25_09:44:07_2013 2
Sat_May_25_09:45:03_2013 2
The first column is for the xaxis
labels while the second column is for the yaxis
values. How can I plot this in xaxis
intervals? For example, in the dataset above, I would want to add only the odd xaxis
labels but still plot every yaxis
values. In other words, a range for the xaxis
labels.
How can I achieve this?
Upvotes: 0
Views: 1234
Reputation: 7802
Assuming your data is in a file t.dat
set xdata time
set timefmt "%b_%d_%H:%M:%S_%Y"
set format x "%d/%m/%y\n%H:%M"
plot "< sed 's/[^_]*_//' t.dat" using 1:2 title "y value"
timefmt
sets the input time format. Unfortunately, the day name isn't a recognised value, so the "< sed 's/[^_]*_//' t.dat"
redirects the output of a sed
command, which strips the day and first underscore, as input.
format
set the output to date newline time, change this to get the format you want.
Upvotes: 2