5

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...

1 Answer 1

7

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.