忽略y = 0的点 [英] Ignore points with y=0

查看:72
本文介绍了忽略y = 0的点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在绘制一个图,我想省略所有y = 0的点.我不知道这些结果出现在哪行的先验知识,所以我不能告诉gnuplot仅使用某些行.

I am plotting a graph and I would like to omit all points that have y=0. I don't know a priori at which lines these results appear, so I can't tell gnuplot to use just some lines.

有可能还是必须编辑我的数据集(并将y = 0替换为超出范围的某处)?

Is that possible or do I have to edit my data set (and replace y=0 for somewhere outside my range)?

推荐答案

您可以很容易地做到这一点:

You can do this pretty easily:

plot "mydataset.dat" u 1:($2 == 0 ? NaN : $2)

在这里,我们使用gnuplot三元运算符将0的值替换为NaN. Gnuplot默默地忽略了NaN,因此应该可以正常工作.

Here we use the gnuplot ternary operator to replace values of 0 with NaN. Gnuplot silently ignores NaN, so that should work just fine.

这篇关于忽略y = 0的点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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