Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I skip empty lines in gnuplot

Tags:

gnuplot

I would like to plot below file using gnuplot with a continues line. the problem is that there is a empty line after each point. I can get a graph with points. Could you please help me?

   x y type

   0 -1866.47  i

 100 -1866.52  i

 200 -1867.11  i

 300 -1868.78  i

 400 -1871.58  i

 500 -1875.4   i

 600 -1880.12  i

 700 -1885.62  i

 800 -1891.81  i

 900 -1898.63  i

1000 -1906.02  i

1100 -1913.94  i

1200 -1922.33  i

1300 -1931.17  i

1400 -1940.43  i

1500 -1950.08  i

1600 -1960.11  i

1700 -1970.49  i

1800 -1981.22  i

1900 -1992.27  i

2000 -2003.63  i
like image 711
ehsan Avatar asked Mar 16 '26 05:03

ehsan


1 Answers

You can filter out the file using an external command. E.g, in a *nix OS, you can use awk:

plot "< awk 'NF!=0 { print $0 }' file.dat" w l

(in awk syntax, NF gives the number of fields in a given line, and $0 contains the entire line)

like image 160
Joce NoToPutinsWarInUkraine Avatar answered Mar 18 '26 17:03

Joce NoToPutinsWarInUkraine



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!