GNUPLOT problem

Hi,
Im trying to plot a time series with gnuplot. this is my script

set xdata time
set yrange [0: ]
set timefmt "%H"
set xrange [ "11:14:00":"11:15:00" ]
set format x "%H:%M:%S"
plot "time_vs_times.txt" using 1:2 title 'Interarrival time' with points lw 2

and this is my data
11:14:18 5
11:14:19 10
11:14:20 14
11:14:21 28
11:14:22 44
11:14:23 41
11:14:24 42
11:14:25 45
11:14:26 34
11:14:27 35
11:14:28 12
11:14:29 10
11:14:30 36
11:14:31 8
11:14:32 9
11:14:33 6
11:14:34 32
11:14:35 31
11:14:36 13
11:14:37 24
11:14:38 25
11:14:39 23
11:14:40 16
11:14:41 10
11:14:42 9
11:14:43 20
11:14:44 19
11:14:45 16
11:14:46 7
11:14:47 12
11:14:48 4
11:14:49 22
11:14:50 8
11:14:51 6
11:14:52 23
11:14:53 20
11:14:54 18
11:14:55 8
11:14:56 6
11:14:57 11
11:14:58 18
11:14:59 7

Everytime i try to plot the data, i dont get xaxis from 11:14:00 to 11:15:00, it always gives me a scale from 11:00 to 12:00.

I do not understand why..pl help me..

Thanks!

Are you sure this is the right forum? ( I cant imagine a UNIX newbie dealing with this sort of issue...)

I'm sorry, but I did not find some forum related directly to this issue. Let me know if there is a better place to put it up.

Try leaving off xrange entirely, letting it pick its own range.

Otherwise, I think you have to specify the range in seconds of epoch time. GNUplot has an epoch of 1970 for some things, and an epoch of 2000 for others :wall:

Try just forgetting the year/month/day and just going on the total count of seconds

Tried that but still the same output :frowning:

will try with epoch times soon, thanks :slight_smile:

---------- Post updated at 07:12 PM ---------- Previous update was at 07:04 PM ----------

my epoch has a high resolution 6digits after the decimal, but the resolution that I want is per second..Im actually converting data from epoch to H:M:S so that I can have this. any other way?? :frowning:

If your data has higher resolution than seconds, what does it actually look like? You've only got HH:MM:SS there.

Epoch time is per second.

Try xrange [ (11*60*60)+(1460), (11*60*60)+(1560)]

The thing is I have my timestamp in epoch and is something like xxxxxxx.xxxxxx the part after the '.' is sub second. So from this i convert it to normal time ignoring the sub second part. and what I want to do is obtain number of times that event has occurred. I use uniq -c -w8 for this.

To do the same in epoch i have to filter in awk just the part before sub seconds and then use uniq on it. trying to figure the awk part now...

provide sample input and a desired output.
most likely you don't need 'uniq' and can do it all in awk.

Hi,

managed to crack it.

The data is like this

1319188458.353690 0.46975
1319188458.823439 0.07558
1319188458.899017 0.00020
1319188458.899217 0.00120
1319188458.900415 0.25879

i split the part before '.' using

cut -d '.' -f1

then used

awk '{counts[$1]++} END {for (i in counts) {print i, counts}}'

put back both the count and time data together using paste -d

and if i plot this data gnuplot works perfectly.

Is there any way to do this all at one go using awk? :slight_smile: that would be great.

Thanks for your help guys!!

awk '{c[substr($1,1,index($1, ".")-1)]++}END{ for (i in c) print i, c}' myFile

perfect :slight_smile: thanks :slight_smile: