0
votes

I have an input file E3 with data arranged as follows:

01/01/2020 00:00 15 0 39
01/01/2020 00:01 3 4 64
01/01/2020 00:02 0 24 9
...
01/07/2020 11:53 13 0 0
01/07/2020 11:54 19 2 20
01/07/2020 11:55 2 0 2

I am trying to plot it with the following code:

set terminal x11 size 1900, 800
set term x11 1 noraise
set grid
set xlabel font "Times Roman, 22"
set xlabel "Date\nTime"
set xdata time
set timefmt "%m/%d/%Y %H:%M"
set xrange [ "01/01/2020 00:00" : "01/07/2020 11:55" ]
set format x "%m/%d\n%H:%M"
set xtics time
set y2label font "Times Roman, 22"
set y2label "Events"
set ytics 10
set y2tics 10
set key left top
plot './E3' using 0:3 with lines title "Delete" ls 15, './E3' using 0:4 with lines title "Failed" ls 4, './E3' using 0:5 with lines title "Update" ls 6
pause  -1

When I try to get gnuplot to run the above it returns the following error:

plot './E3' using 0:3 with lines title "Delete" ls 15, './E3' using 0:4 with lines title "Failed" ls 4, './E3' using 0:5 with lines title "Update" ls 6

                                                    ^
"enum.gnu.1", line 18: all points y value undefined!

Commenting out the set xrange eliminates the error. However, in the plot the tics on the x axis are 01/01\n00:00, 01/01\n00:15, ... 01:01\n02:45 - which is not what I want. What I want is to have an x tic every day - which corresponds to 1440 data points - each tic labeled with the date and the time. I.e. 01/01\n00:00, 01/02\n00:00, ... 01/07\n00:00.

What am I doing wrong?

1

1 Answers

0
votes

First of all, why are you plotting column 0 instead of 1? Next, data/time is internally counted in seconds. So, if you want one tic every day you have to set it to 60*60*24 seconds.

If you change the following lines it should work:

set xtics 60*60*24 time

and

plot $Data using 1:3 with lines title "Delete" ls 15, \
     '' using 1:4 with lines title "Failed" ls 4, \
     '' using 1:5 with lines title "Update" ls 6