gnuplot conditional plotting: plot col A:col B if col C == x
Consider the following dataset (1.dat), 1 0.8 0 2 0.6 0 3 0.9 1 4 1.1 0 5 0.7 0 6 0.6 1 where we want to plot the first two columns only when the third one equals zero. Then you can try this: plot ‘1.dat’ using 1:($3==0?$2:1/0) (Credit to markjoe on Gnuplot mailing-list.)