gnuplot - 如何在 gnuplot 中标记 90 个百分位

标签 gnuplot

如何在 gnu 图中标记 90 个百分位。需要 sample

plot [][] "fle.txt" using 1:2 with lines

这就是我绘制图表的方式我想在图表中标记 90% 这是我的数据集

time(seconds)  frequency  cumulativeFrequency
10             2          2
11             6          8
12             8          16
13             10         26
14             7          33
15             5          38
16             5          43
17             4          47
18             2          49

最佳答案

我在 gnuplot 中看不到任何方法可以做到这一点,但使用 python 并不难 --

# percent90.py
import sys
def to_num(iterable):
    for line in iterable:
        columns = line.split()  # split into columns
        if not columns:  # empty line
            continue
        try:
            yield float(columns[1])  # This is a good number -- Yield it and keep going
        except ValueError:  # Not a number on the line
            pass            # just keep going -- do nothing
        except IndexError:
            print line

with open(sys.argv[1]) as fin:
     data = sorted(to_num(fin))

top_10 = data[int(len(data)*0.9):]  #top 10 percent of the data
print(top_10[0])

你可以这样称呼:

python percent90.py path/to/datafile

这将告诉您在哪里放置标记。至于标记它,我可能会在 gnuplot 中做这样的事情:

YVAL = `python percent90.py path/to/datafile`
set arrow 1 from graph 0,first YVAL to graph 1,first YVAL ls 1 nohead front

关于gnuplot - 如何在 gnuplot 中标记 90 个百分位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14620120/

相关文章:

使用qt的c++应用程序,如何包含gnuplot

gnuplot - 如何在 gnuplot 中创建 3d 相空间图?

gnuplot - 如何在 gnuplot 中设置轴单位

gnuplot : handle tsv file with missing (empty) data

python - 绘制三元/三角图的库/工具

plot - 如何使用 gnuplot 在一张图中的同一 x 轴上绘制三个 y 轴?

plot - 如何在 gnuplot 中强制颜色范围

gnuplot - gnuplot 中的 output.png 不如提示 shell 中的图好

gnuplot - gnuplot 和 AquaTerm 有什么区别?

gnuplot - 更改 gnuplot 中 tic 之间的实际空间