【问题标题】:Gnuplot stats min does not detect negative numbersGnuplot stats min 不检测负数
【发布时间】:2021-05-21 22:57:43
【问题描述】:

正如您在这篇帖子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

【问题讨论】:

    标签: gnuplot


    【解决方案1】:

    正如您链接到的问题和答案中所述,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
    

    【讨论】:

      【解决方案2】:

      对于主要问题,请填写您的范围:

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

      【讨论】:

        猜你喜欢
        • 2011-09-02
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-10-08
        • 2019-07-04
        • 1970-01-01
        相关资源
        最近更新 更多