Nadia
Nadia

Reputation: 85

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

Upvotes: 3

Views: 1125

Answers (1)

Christoph
Christoph

Reputation: 48390

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

Upvotes: 3

Related Questions