3

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

1 Answer 1

3

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
Sign up to request clarification or add additional context in comments.

2 Comments

I renumbered my files to range from 1 to 100 and now the plot shows 100 data sets. Thank you for the help!
That's also fine :) So if this answer solved your problem you can accept it (click the gray check mark), see also stackoverflow.com/help/someone-answers

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.