Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.graphics.apps.gnuplot > #3215 > unrolled thread
| Started by | Jörg Buchholz <bookwood4news@freenet.de> |
|---|---|
| First post | 2016-02-04 20:42 +0100 |
| Last post | 2016-02-09 22:48 +0100 |
| Articles | 9 — 4 participants |
Back to article view | Back to comp.graphics.apps.gnuplot
stats for a row not a column Jörg Buchholz <bookwood4news@freenet.de> - 2016-02-04 20:42 +0100
Re: stats for a row not a column Jörg Buchholz <bookwood4news@freenet.de> - 2016-02-05 18:34 +0100
Re: stats for a row not a column Karl Ratzsch <mail.kfr@gmx.net> - 2016-02-05 19:46 +0100
Re: stats for a row not a column Jörg Buchholz <bookwood4new@freenet.de> - 2016-02-05 21:09 +0100
Re: stats for a row not a column Karl Ratzsch <mail.kfr@gmx.net> - 2016-02-07 17:54 +0100
Re: stats for a row not a column Jörg Buchholz <bookwood4news@freenet.de> - 2016-02-08 19:32 +0100
Re: stats for a row not a column Karl Ratzsch <mail.kfr@gmx.net> - 2016-02-09 10:15 +0100
Re: stats for a row not a column Ethan A Merritt <sfeam@users.sourceforge.net> - 2016-02-09 11:44 -0800
Re: stats for a row not a column Karl Ratzsch <mail.kfr@gmx.net> - 2016-02-09 22:48 +0100
| From | Jörg Buchholz <bookwood4news@freenet.de> |
|---|---|
| Date | 2016-02-04 20:42 +0100 |
| Subject | stats for a row not a column |
| Message-ID | <n909ea$1lk$1@dont-email.me> |
Hello, is there a way to use the stats command for a row? Data: - a b c A 1 2 3 B 1 - 5 C 1 2 3 stats 'file' u 3 Records: 2 Mean: 2.0000 Sum: 4.0000 So this is for the col b. I want to do this for the row B, but I don't have a good idea to do this. Jörg
[toc] | [next] | [standalone]
| From | Jörg Buchholz <bookwood4news@freenet.de> |
|---|---|
| Date | 2016-02-05 18:34 +0100 |
| Message-ID | <n92ma5$v6q$1@dont-email.me> |
| In reply to | #3215 |
On 04.02.2016 20:42, Jörg Buchholz wrote: > Hello, > > is there a way to use the stats command for a row? > > Data: > - a b c > A 1 2 3 > B 1 - 5 > C 1 2 3 > > stats 'file' u 3 > > Records: 2 > Mean: 2.0000 > Sum: 4.0000 > > So this is for the col b. > > I want to do this for the row B, but I don't have a good idea to do this. So I try the option "every", on a plot every ::2::2 only takes the third line/row. stats 'file' every ::2::2 matrix But it takes the third column and not the third row. Another different between "stats using" and "stats every" ist the handling of NaN. "stats using" handle NaN as "nothing", so strings will be ignored. "stats every" handle NaN as zero. So the sum is the same but the mean is different. Jörg
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2016-02-05 19:46 +0100 |
| Message-ID | <n92qmm$i8v$1@solani.org> |
| In reply to | #3215 |
Am 04.02.2016 um 20:42 schrieb Jörg Buchholz: > > is there a way to use the stats command for a row? > It should be possible with "stats matrix", if you limit the yrange in the right way? Karl
[toc] | [prev] | [next] | [standalone]
| From | Jörg Buchholz <bookwood4new@freenet.de> |
|---|---|
| Date | 2016-02-05 21:09 +0100 |
| Message-ID | <n92vbv$4i9$1@dont-email.me> |
| In reply to | #3217 |
On 05.02.2016 19:46, Karl Ratzsch wrote: > Am 04.02.2016 um 20:42 schrieb Jörg Buchholz: >> >> is there a way to use the stats command for a row? >> > > It should be possible with "stats matrix", if you limit the yrange > in the right way? I try it with the option "every", but get also only colums and not rows. Next problem with "stats matrix" is "mean". "B 1 - 5" mean in "stats matrix" is 1.5 (6/4). In "stats using" the mean is 3.0 (6/2). That is what I wont to have. So for me there a two problems and no solution. Is it intentional that "stats matrix" and "stats using" calculate the mean in two different ways? Jörg
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2016-02-07 17:54 +0100 |
| Message-ID | <n97ssc$i9v$1@solani.org> |
| In reply to | #3218 |
Am 05.02.2016 um 21:09 schrieb Jörg Buchholz: > On 05.02.2016 19:46, Karl Ratzsch wrote: >> It should be possible with "stats matrix", if you limit the yrange >> in the right way? > > I try it with the option "every", but get also only colums and not rows. > > Next problem with "stats matrix" is "mean". > > "B 1 - 5" mean in "stats matrix" is 1.5 (6/4). In "stats using" the mean > is 3.0 (6/2). That is what I wont to have. So for me there a two > problems and no solution. > > Is it intentional that "stats matrix" and "stats using" calculate the > mean in two different ways? Hm. "every" is not what you want. I'm not even sure how it should work with matrix data. Limiting the y range with "stats matrix" indeed doesn't work: $dat << EOD 10 10 10 20 20 20 40 40 40 100 1000 10000 EOD stats [:] [1:1] $dat matrix The second range specifier refers to the data (z) values, not the constructed abscissa values. "set yrange" has no effect. And there seems to be a general problem with stat matrix, it interacts strangely with splot: splot $dat stats $dat matrix gives the mean of the x-axis values (here 0,1,2), as long as that splot is the last plot command. If you give plot $dat stats $dat matrix the correct mean is again returned.
[toc] | [prev] | [next] | [standalone]
| From | Jörg Buchholz <bookwood4news@freenet.de> |
|---|---|
| Date | 2016-02-08 19:32 +0100 |
| Message-ID | <n9amq4$i2c$1@dont-email.me> |
| In reply to | #3219 |
On 07.02.2016 17:54, Karl Ratzsch wrote:
> Am 05.02.2016 um 21:09 schrieb Jörg Buchholz:
>> On 05.02.2016 19:46, Karl Ratzsch wrote:
>>> It should be possible with "stats matrix", if you limit the yrange
>>> in the right way?
>>
>> I try it with the option "every", but get also only colums and not rows.
>>
>> Next problem with "stats matrix" is "mean".
>>
>> "B 1 - 5" mean in "stats matrix" is 1.5 (6/4). In "stats using" the mean
>> is 3.0 (6/2). That is what I wont to have. So for me there a two
>> problems and no solution.
>>
>> Is it intentional that "stats matrix" and "stats using" calculate the
>> mean in two different ways?
>
> Hm. "every" is not what you want. I'm not even sure how it should work
> with matrix data.
>
> Limiting the y range with "stats matrix" indeed doesn't work:
>
> $dat << EOD
> 10 10 10
> 20 20 20
> 40 40 40
> 100 1000 10000
> EOD
>
> stats [:] [1:1] $dat matrix
>
> The second range specifier refers to the data (z) values, not the
> constructed abscissa values. "set yrange" has no effect.
>
> And there seems to be a general problem with stat matrix, it interacts
> strangely with splot:
As a workaround I rotate the matrix and use "stats using" to get the
relevant mean.
data = 'matrix.dat'
system (sprintf("cat %s | rs -T >%s.trans",data,data))
Jörg
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2016-02-09 10:15 +0100 |
| Message-ID | <n9cao5$j5$1@solani.org> |
| In reply to | #3219 |
Am 07.02.2016 um 17:54 schrieb Karl Ratzsch: > Limiting the y range with "stats matrix" indeed doesn't work: > > $dat << EOD > 10 10 10 > 20 20 20 > 40 40 40 > 100 1000 10000 > EOD > > stats [:] [1:1] $dat matrix > > The second range specifier refers to the data (z) values, not the > constructed abscissa values. "set yrange" has no effect. > > And there seems to be a general problem with stat matrix, it interacts > strangely with splot: > > splot $dat > stats $dat matrix > > gives the mean of the x-axis values (here 0,1,2), as long as that splot > is the last plot command. If you give > > plot $dat > stats $dat matrix > > the correct mean is again returned. I've filed a bug on https://sourceforge.net/p/gnuplot/bugs/1739/ for this.
[toc] | [prev] | [next] | [standalone]
| From | Ethan A Merritt <sfeam@users.sourceforge.net> |
|---|---|
| Date | 2016-02-09 11:44 -0800 |
| Message-ID | <n9dfdr$7bf$1@dont-email.me> |
| In reply to | #3218 |
Jörg Buchholz wrote: > On 05.02.2016 19:46, Karl Ratzsch wrote: >> Am 04.02.2016 um 20:42 schrieb Jörg Buchholz: >>> >>> is there a way to use the stats command for a row? Not that I know of. >> It should be possible with "stats matrix", if you limit the yrange >> in the right way? I don't think you can use xrange or yrange to limit the indices in a matrix. But I could be wrong on this point. > Next problem with "stats matrix" is "mean". > > "B 1 - 5" mean in "stats matrix" is 1.5 (6/4). In "stats using" the mean > is 3.0 (6/2). That is what I wont to have. So for me there a two > problems and no solution. > > Is it intentional that "stats matrix" and "stats using" calculate the > mean in two different ways? Yes. "stats using N" will only look at column N "stats matrix" will look at all entries in the matrix Note that normally in the latter case you want "stats matrix using 3", since that is what will get you the value of the element matrix[i][j]. In the absence of an explicit using specification it probably defaults to the equivalent of "matrix using 1", which would give you the x coordinate of each matrix entry rather than its value. Ethan
[toc] | [prev] | [next] | [standalone]
| From | Karl Ratzsch <mail.kfr@gmx.net> |
|---|---|
| Date | 2016-02-09 22:48 +0100 |
| Message-ID | <n9dmrr$5db$1@solani.org> |
| In reply to | #3223 |
Am 09.02.2016 um 20:44 schrieb Ethan A Merritt: >> On 05.02.2016 19:46, Karl Ratzsch wrote: >>> It should be possible with "stats matrix", if you limit the yrange >>> in the right way? > > I don't think you can use xrange or yrange to limit the indices > in a matrix. But I could be wrong on this point. limiting the xrange works, but yrange setting gets ignored
[toc] | [prev] | [standalone]
Back to top | Article view | comp.graphics.apps.gnuplot
csiph-web