That's intended. The idea is that you can run
the stats command on a subset of the whole
data set, and you use the plot ranges to select
the subset.
This is done in correspondence with the fit command,
which works exactly the same way.
When there is only one column, the values are
currently treated as x-values, not y-values. I find
that intuitive, although I can see why you expected
something different (namely correspondence with
the plot command).
Best,
Ph.
On Monday 21 December 2009 08:22:00 pm Ethan Merritt wrote:
> I have a question about the intended behaviour of the stats command.
> What I observe is that the current xrange affects the result of a
> command like
> stats 'file' using 3
>
> I find this unexpected. Is it intended, or is it a bug?
>
> Here's what I was trying to do...
>
> # preliminary exploration and plot of data column 2
> stats 'silver.dat' using 2 noout var "Ag2_"
> print Ag2_records, Ag2_min, Ag2_max
> set xrange [0:1]
> set yrange [Ag2_min:Ag2_max]
> plot 'silver.dat' using (1):2 with points pt 6
>
> # So far so good, Ag_records = 58
> # and the plot shows the scatter of column 2 values
>
> # preliminary exploration and plot of data column 3
> stats 'silver.dat' using 3 nout var "Ag3_"
> plot 'silver.dat' using (1):3 with points pt 6
> ...
>
> Oops. The stats command + plot fails, claiming there is only 1 data point.
> (Actually in one run it claimed 0 data points, but leave that for another
> day). However...
> set xrange [*:*]
> stats 'silver.dat' using 3 nout var "Ag3_"
> ...
>
> This works, indicating to me that the xrange is the cause of the problem.
>
>
> Here's my thinking:
> When you issue a plot command with a single column, e.g. "plot 'foo' using
> 3", the values in column 3 are treated a y values, not x values. I
> wouldn't expect a filter on x to do anything here. The stats documentation
> patch says:
>
> The `stats` command will only consider data points which fall into the
> plot range as defined inline or using `set xrange` and `set yrange`. If a
> value in either column falls outside of its corresponding range, the
> entire record is skipped and does not contribute to any of the summary
> statistics.
>
> I read this to mean that if you say, e.g.
> stats 'foo' using N:M
> then column N is checked against the x range and column M is checked
> against the y range. But I expected
> stats 'foo' using Q
> to check Q only against the y range, with no check on x.
>
> Bug? Intentional?
> Am I looking at this the wrong way?
>
> cheers,
>
> Ethan
|