Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

stats function in gnuplot 4.6.1

786 views
Skip to first unread message

Dom

unread,
Nov 5, 2013, 10:01:16 PM11/5/13
to
Hello,

I would like to use the stats function, I started with stats.dem which works fine with the data the demo was designed for, but when I use my data, it doesn't work, my data looks like this:

07:41:52 7.8 111.3 359.5 1069.8 119.1 1429.3
07:41:53 89.1 251.3 9015.6 2265.7 340.4 11281.3
07:41:54 27.4 94.2 9958.1 1101.8 121.6 11059.9

I need to find when the maximum value of column 6 and 7 occur (time stamp). I have tried to adapt the code in stats.dem with no luck.


Thanks,
Dom

Karl

unread,
Nov 12, 2013, 7:25:45 AM11/12/13
to
What did you try to do this?

I think it just isn´t implemented at the time. If you do

set xdata time
stats "data.dat"

gnuplot says

"Stats command not available in timedata mode"


I guess this shouldn´t be hard to implement, perhaps you can leave a
feature request on gnuplot.sf.net


Karl


Ethan A Merritt

unread,
Nov 12, 2013, 7:55:04 PM11/12/13
to
Karl wrote:

> Am 06.11.2013 04:01, schrieb Dom:
>> Hello,
>>
>> I would like to use the stats function, I started with stats.dem which
>> works fine with the data the demo was designed for, but when I use my
>> data, it doesn't work, my data looks like this:
>>
>> 07:41:52 7.8 111.3 359.5 1069.8 119.1 1429.3
>> 07:41:53 89.1 251.3 9015.6 2265.7 340.4 11281.3
>> 07:41:54 27.4 94.2 9958.1 1101.8 121.6 11059.9
>>
>> I need to find when the maximum value of column 6 and 7 occur (time
>> stamp). I have tried to adapt the code in stats.dem with no luck.
>>
>
> What did you try to do this?
>
> I think it just isn´t implemented at the time. If you do
>
> set xdata time
> stats "data.dat"
>
> gnuplot says
>
> "Stats command not available in timedata mode"


True. But it's possible to interpret time data using generic
string commands. I prefer this to timedata mode in any case.

# This converts the time string in column COL to a number of seconds
intime(COL) = strptime("%H:%M:%S",strcol(COL))

# This finds correlation of time (seconds) in col 1 with the value in col 6
stats 'data' using (intime(1)):6

# This prints a time, not necessarily unique, at which the
# maximum value in column 6 occurred
print strftime("%H:%M:%S", STATS_pos_max_y)

That is, I think, what you wanted. Note that you don't get any
warning if that same maximum time occurs on multiple lines.

Ethan
0 new messages