If you want to filter out completely all points with value -1
, you can do it as follows:
splot 'file' using 1:2:($4 == 1 ? $3 : 1/0) with points
That assumes, that your data file has four columns with the x, y, z value in the columns 1, 2, 3 and in the fourth column the values 1
or -1
.
With the using
statement you can specify which columns are used for plotting: using 1:2:3
uses the first column as x, the second as y and the third column as z value.
You can also do calculations inside the using
statement. In that case you must put the respective expression in braces, and refer to the values of a column with e.g. $3
or column(3)
: using 1:2:($3/10)
would scale the values in the third column by 10
and use the result as z value.
The expression I used above, using 1:2:($4 == 1 ? $3 : 1/0)
does the following: If the value in the fourth column is equal to 1
, use the value in the third column, otherwise use 1/0
. The 'special' value 1/0
makes gnuplot ignore a point.