I have a data file which I want to plot with gnuplot. However, for the y-axes I want gnuplot to ignore all points below a certain value. Is there an easy way for doing this, especially that the data file is huge?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are (at least) 2 ways without relying on an external tool.
The second way is to use the gnuplot ternary operator in a using statement. Note that gnuplot silently ignores undefined values (1/0) when doing file IO.
This assumes you have a space separated datafile and you want to plot the first column on the x-axis and the second column on the y-axis (in typical gnuplot fashion).
The first way is simplest, but it doesn’t allow you to trim off points that are in the range you want to plot. The second way is a little uglier, but is a lot more general, and can be used to make all sorts of input filters for gnuplot data.
Of course, if your gnuplot supports pipes and you want to use an external tool to write a filter, you can do that too. Just have to tool accept the datafile as an input and write the modified data to stdout. Then in gnuplot:
For this problem,
awkwould be a great tool.