Ignore points with y=0

后端 未结 2 1149
盖世英雄少女心
盖世英雄少女心 2020-12-29 10:45

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 som

2条回答
  •  轮回少年
    2020-12-29 11:21

    You can do this pretty easily:

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

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

提交回复
热议问题