Question

I have a data file with 3 column and I want to plot with 2 of them. But I want to use the third with a condition to exclude or not the line from the plot (For example, if $3 < 10 the data line isn't valid). I know there is set datafile missing but this case is somewhat peculiar and I don't know how to do that. Any help is appreciated...

Was it helpful?

Solution

You can use conditional logic in the using expression in the plot command:

plot 'data.dat' u 1:($3 < 10 ? 1/0 : $2)

This command plots 1/0 (it skips that data point) if the value in the third column is < 10, and otherwise plots the value in the second column.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top