如何在gnuplot中标记90%

Gee*_*han 3 gnuplot

如何在gnu图中标记90%。需要样品

plot [][] "fle.txt" using 1:2 with lines
Run Code Online (Sandbox Code Playgroud)

这是我绘制图形的方式,我想在图形中标记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
Run Code Online (Sandbox Code Playgroud)

mgi*_*son 5

我看不到任何单独在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])
Run Code Online (Sandbox Code Playgroud)

您可以这样称呼:

python percent90.py path/to/datafile
Run Code Online (Sandbox Code Playgroud)

这将告诉您标记的位置。至于标记,我可能会在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
Run Code Online (Sandbox Code Playgroud)