Alex Rivera | Logout

Gnuplot plotting data from a file up to some row

Asked 2012-03-02T16:12:43.487
50

I have data in some text file which has let's say 10000 rows and 2 columns. I know that I can plot it easily by plot "filename.txt" using 1:2 with lines . What I want is however just plotting let's say the rows from 1000 to 2000 or any other reasonable selection. Is it possible to do that easily? Thank you very much in advance.

Edit
Report

1 Answer

1

Gnuplot ignores NaN values. This works for me for a specified range of the x coordinate. Not sure how to specify row range though.

cutoff(c1,c2,xmin,xmax) = (c1>=xmin)*(c1<=xmax) ? c2 : NaN
plot "data.txt" u 1:(cutoff(($1),($2),1000,2000))
answered 2013-05-14T10:49:02.273

Your Answer