Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gnuplot for loop with interval

I have the following gnuplot script that uses a for loop to plot 100 data sets of (x,y) format to one plot. However, the script only plots 2 data sets. Can anybody help? Thank you.

plotfile = "graph.eps"
set output plotfile
filename(n) = sprintf("%d_mod.int", n)
plot for [i = 400000:4000000:400000] filename(i) u 1:2 title sprintf("%d", i) w lp
like image 997
Nadia Avatar asked Dec 06 '25 23:12

Nadia


1 Answers

That is a bug, which will be fixed in 4.6.6 and 5.0, see #1429 Erratic behaviour of do for loops .

As a workaround you must iterate over smaller numbers:

plot for [i = 4:40:4] filename(i*100000) u 1:2 title sprintf("%d", i*100000) w lp
like image 168
Christoph Avatar answered Dec 09 '25 15:12

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!