2
votes

I'm trying to use the for-loop construct in current gnuplot 4.6 patchlevel 5 to plot several data files at once. The files are named like "file_1000000" from "file_0" up to "file_10000000" in increments of 1M. However, using

plot for [i=0:1e7:1e6] "file_".i

only draws file_0 and file_1000000 (1M). Thus I tried a simple loop such as

do for [i=0:1e7:1e6] {
  print i
}

resulting also in only 0 and 1M as output. Then I started to play with the increment number and the script prints the numbers up to the following values:

  • 100 => all numbers up to 1e7
  • 200 => all numbers up to 1e7
  • 300 => none at all (?!)
  • 400 => none at all
  • 500 => up to 1410000
  • 600 => up to 2841600
  • 700 => none at all
  • 800 => none at all
  • 900 => up to 455400

Of cause I can circumvent this issue using something like

do for [i=1:10] {
  j=1000000*i
  plot "file_".j
}

but I'd like to understand what gnuplot does here. Does anyone know the reason for this odd behavior? I'd be grateful for any advice.

1
possible duplicate of gnuplot for loop with interval - Christoph

1 Answers

-1
votes

A quote: "Multiple datafiles and/or functions may be plotted in a single command, separated by commas." on page 72.