Gnuplot stats min 不检测负数

Gnuplot stats min does not detect negative numbers

正如您在此 post gnuplot "stats" command unexpected min & "out of range" results 中所见,gnuplot 统计信息将列中可用的最小非负数作为最小值。

如何包含负数?我的列有负数,我想将负数作为应用于轴范围的最小值。

顺便说一句,我打电话给:

        stats mytextfile u 2:3 nooutput

但实际上后来我不得不再次调用它,因为我想从 4 列中获取最小值和最大值。我可以马上做吗?还是我必须像下面那样做?:

    stats mytextfile u 2:3 nooutput
    do whatever
    stats mytextfile u 4:5 nooutput
    do whatever

对于主要问题,输入你的范围:

    stats [-9999:9999] mytextfile u 2:3 nooutput

如您链接到的问题和答案中所述,stats 将在当前的 x 和 y 范围内完成。 因此,如果您有疑问,只需设置范围 [*:*],如果您使用两列,则设置范围 [*:*][*:*]。 根据您具体想要做什么,您可以以此为起点。

代码:

### stats on several columns
reset session

$Data <<EOD
1  -0.1  -0.2  -0.3  -0.4
2   0.0   0.0   0.0   0.0
3   0.1   0.1   0.1   0.1
4   0.2   0.2   0.2   0.2
5   0.3   0.3   0.3   0.3
6   0.4   0.4   0.4   0.4
7   1.5   2.5   3.5   4.5
EOD

do for [i=2:5] {
    stats [*:*] $Data using i nooutput
    print sprintf("Column %d:  min: % 4g, max: % 4g",i, STATS_min, STATS_max)
}
### end of code

结果:

Column 2:  min: -0.1, max:  1.5
Column 3:  min: -0.2, max:  2.5
Column 4:  min: -0.3, max:  3.5
Column 5:  min: -0.4, max:  4.5