How to add offset to time based data when plotting in gnuplot

I want to add an offset to the time based data from the file I want to build using gnuplot. I can build the data just fine, but when I try to add a temporary offset, the graph is empty.

The goal is to build several bars next to each other, as described here, but with time-based data: Two “boxed” charts next to each other with gnuplot

Data file:

00:00 7719
01:00 20957
02:00 15989
03:00 9711
04:00 1782
05:00 871
06:00 4820
07:00 860
08:00 873
09:00 848
10:00 879
11:00 726
12:00 944
13:00 924
14:00 996
15:00 806
16:00 848
17:00 967
18:00 2277
19:00 2668
20:00 32183
21:00 14414
22:00 20426
23:00 16140

I am trying to build data using this code:

set xdata time
set timefmt "%H:%S"
set format x "%H"
set style fill solid 0.6 border -1
set boxwidth 0.3 relative
plot ["00:00":"23:30"] 'data.dat' using ($1-0.3):2 with boxes, \
  'data.dat' using ($1+0.3):2 with boxes

This is just a test - there are additional data columns in the real data file, and I'm trying to put them next to each other using an offset, however, I was out of luck with the data and the time offsets.

Without bias, the code is in order:

set xdata time
set timefmt "%H:%S"
set format x "%H"
set style fill solid 0.6 border -1
set boxwidth 0.3 relative
plot ["00:00":"23:30"] 'data.dat' using 1:2 with boxes
+4
1

timedata timecolumn(), set timefmt. . , :

set xdata time
set timefmt "%H:%S"
set format x "%H"
set style fill solid 0.6 border -1
set boxwidth 0.3 relative
set xrange["00:00":"23:30"]
set style data boxes
plot 'data.dat' using 1:2, \
     '' using (timecolumn(1)+60*20):($2*0.5), \
     '' using (timecolumn(1)+60*40):($2*0.7)

:

enter image description here

histogram xtic strftime timecolumn:

set timefmt "%H:%S"
set style fill solid 0.6 border -1
set style data histogram
set style histogram clustered gap 1
plot 'data.dat' using 2:xtic(strftime('%H', timecolumn(1))), \
     '' using ($2*0.5), \
     '' using ($2*0.7)

:

enter image description here

set style histogram clustered gap 0.

, -

plot 'data.dat' using 2:xtic((int($0) % 2 == 0) ? strftime('%H', timecolumn(1)) : '')

($0 ).

+13

All Articles