Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #2195

Re: stats function in gnuplot 4.6.1

From Ethan A Merritt <sfeam@users.sourceforge.net>
Newsgroups comp.graphics.apps.gnuplot
Subject Re: stats function in gnuplot 4.6.1
Date 2013-11-12 16:55 -0800
Organization gnuplot development
Message-ID <l5uila$cme$1@dont-email.me> (permalink)
References <b71a46a1-d28a-4eb0-b7d9-c20eab8bc2b6@googlegroups.com> <l5t6o7$ffd$1@news.rz.uni-karlsruhe.de>

Show all headers | View raw


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



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

Back to comp.graphics.apps.gnuplot | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

stats function in gnuplot 4.6.1 Dom <domenic.forgione56@gmail.com> - 2013-11-05 19:01 -0800
  Re: stats function in gnuplot 4.6.1 Karl <mail.kfr@gmx.net> - 2013-11-12 13:25 +0100
    Re: stats function in gnuplot 4.6.1 Ethan A Merritt <sfeam@users.sourceforge.net> - 2013-11-12 16:55 -0800

csiph-web