使用 AWK 获取最后一个数据列以创建线点 gnuplot

take the last data column with AWK to create a linepoints gnuplot

我正在使用 gnuplot linepoints 来创建计算和正态分布图。我创建了一个文件来为两个图表提供信息。 当我试图绘制最后的数据时遇到了问题。 这是我创建第二张图的脚本。

plot.plt

set term pos eps
set style data linespoints
set style line 1 lc 8 lt -1    

set size 1,1
set yr [0:20]
set key below 
set grid
set output 'output.eps'
plot "<awk '{i=i+; print ,i}' data.dat" smooth cumulative t 'twitter' ls 1

data.dat

5.0     1   0.10
9.0     5   0.20
13.0    7   0.30
14.0    1   0.20
15.0    9   0.20

我想用第一列创建 x 轴,用最后一列创建 y 轴。所以y轴范围必须在0到1之间。我应该改变哪一部分?谢谢

smooth cumulative就够了,不用awk。您正在执行两次相同的操作,一次使用 gnuplot,一次使用 awk。只需做

plot 'data.dat' using 1:3 smooth cumulative