Gnuplot:如何从多列数据文件中找到与最大y值对应的x坐标?

时间:2016-11-28 20:41:45

标签: plot gnuplot

我有一个gnuplot文件plot.gp,其内容为:

set terminal epslatex
set output 'data_plot.tex'
set multiplot

stats "data_file_1.dat" u 4 name "A"
stats "data_file_2.dat" u 4 name "B"

plot 'data_file_1.dat' u ($1<A_pos_max_y ? $1+10-A_pos_max_y : $1-A_pos_max_y):4 w p lt rgb "red",
'data_file_2.dat' u ($1<A_pos_max_y ? $1+10-A_pos_max_y : $1-A_pos_max_y):4 w p lt rgb "green"

data_file_1.datdata_file_2.dat都是包含10行和5列的数据文件。内容分别为:

#1  2   3   4   5
1   1   1   2   1
2   1   1   4   1
3   1   1   6   1
4   1   1   8   1
5   1   1   16  1
6   1   1   9   1
7   1   1   7   1
8   1   1   5   1
9   1   1   3   1
10  1   1   2   1

#1  2   3   4   5
1   1   1   5   1
2   1   1   7   1
3   1   1   12  1
4   1   1   18  1
5   1   1   9   1
6   1   1   5   1
7   1   1   7   1
8   1   1   3   1
9   1   1   2   1
10  1   1   1   1

我需要对应于最大y值的x坐标(第1列)(来自第4列)。 gnuplot显示错误消息

undefined variable: A_pos_max_y

是否有其他方法可以对相应的x坐标进行最大y值的微调?

0 个答案:

没有答案