The documentation of the stats command says, that the first column is affected by the x-axis settings, the second column by the y-axis. That is wrong if only a single column is used. In that case this single column is also affected by the y-axis settings:
$data <<EOF
10
20
30
40
EOF
stats [10:20] $data using 1 nooutput
print STATS_records # -> 4, wrong
stats [][10:20] $data using 1 nooutput
print STATS_records # -> 2, correct
The attached patch proposes a new explanation. I also added {<ranges>} to the supported parameters.
Thanks,
Christoph