如果col A有子串则绘图 [英] plot if col A has substring

查看:74
本文介绍了如果col A有子串则绘图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在gnuplot中执行此操作:

I need to do this in gnuplot:

plot 1:4 where col 2=="P1", col 3=="3", col 1 has substring "blur1"

这里有一个数据集:

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

谢谢.

推荐答案

AFAIK,您需要使用外部脚本来检查子字符串.类似awk并使用

AFAIK you need to use an external script to check for substrings. Something like awk and use

plot "< awk '{...awk commands...}' input.dat"

如果您只想测试col_2是否为P1,则可以在gnuplot中通过以下方式进行

If you just want to test col_2 for P1 you can do it in gnuplot via

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

plot "input.dat" u 3:(f(strcol(2),$4))

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

strcol(n) gets the n-ths column as a string. "eq" can be used to compare strings.

这篇关于如果col A有子串则绘图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆