如果col A有子串,则绘制图

jit*_*hsk 3 gnuplot

我需要在gnuplot中这样做:

plot 1:4 where col 2=="P1", col 3=="3", col 1 has substring "blur1"
Run Code Online (Sandbox Code Playgroud)

下面是一个数据集:

col_1          col_2        col_3    col_4
gcc.blur1.O0   P1           3        10.5
icc.blur1.O2   P2           5        9.8
gcc.blur2.O3   P2           3        8.9
Run Code Online (Sandbox Code Playgroud)

提前致谢.

小智 5

AFAIK您需要使用外部脚本来检查子字符串.像awk和使用的东西

plot "< awk '{...awk commands...}' input.dat"
Run Code Online (Sandbox Code Playgroud)

如果您只想测试P1的col_2,可以在gnuplot中进行测试

f(x,y)= (x eq "P1"? y : 1/0)

plot "input.dat" u 3:(f(strcol(2),$4))
Run Code Online (Sandbox Code Playgroud)

strcol(n)将第n列作为字符串."eq"可用于比较字符串.