title: Using gnuplot to generate a set of numbered images
body: <p>I'm a newbie in Python and I would like to ask you, how can I get images (a lot of images) made by Gnuplot.py with variable in name? I have this function, which creates single image:</p>
  
  <pre><code>def printimage(conf, i):
     filename = str(i) + "out.postscript"
     g = Gnuplot.Gnuplot()
     g.title('My Systems Plot')
     g.xlabel('Date')
     g.ylabel('Value')
     g('set term postscript')
     g('set out filename')
     databuff = Gnuplot.File(conf, using='1:2',with_='line', title="test")
     g.plot(databuff)
  </code></pre>
  
  <p>And this function is used in for loop:</p>
  
  <pre><code>i = 0
  for row in data:
     config_soubor.write(str(i) + " " + row[22:])
     printimage("config_soubor.conf", i)
     i = i + 1
  </code></pre>
  
  <p>I still can't get rid of error "undefined variable: filename".</p>
  
  <p>Thanks,
  Majzlik</p>