Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Columns plotting in gnuplot in same file

Tags:

loops

gnuplot

I have a file which have 18 columns. Using gnuplot, I want to plot them in this way: 1:2, 3:4, 5:6, ..., 17:18.

I have been trying with a do loop, but I don't know how to include the running index in the loop in the number of the colums. I tried something like that:

for [i=1:18] plot "numbers.dat" using (2*(i-1)+1):(2*(i-1)+2)

Thanks

like image 686
JASeijas Avatar asked Jul 18 '26 22:07

JASeijas


1 Answers

To have the result of an arithmetical expression used as column index, use the column function:

plot for [i=1:18] "numbers.dat" using (column(2*(i-1)+1)):(column(2*i))
like image 139
Christoph Avatar answered Jul 20 '26 17:07

Christoph



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!