title: how to plot multiple pictures with pylab in python?
body: <p>i have the following code:</p>
  
  <pre><code>import psycopg2
  import pylab
  
  
  class Datenanzeige:
  
  def __init__(self):
      self.conn = psycopg2.connect("dbname='test' user='test' host='test' password='test'")
      self.cur = self.conn.cursor()
  
      self.site = ['FFF', 'PPP', 'DDD', 'KKK']
      self.plant = [1, 2, 3, 4, 5, 6]
  
  
  def anzeige(self):
  
      for i in range(4):
          for j in range(6):
  
              self.datProd1 = []
              self.datProd2 = []
  
              self.cur.execute(""" 
                      SELECT proddate, Sum(mods) AS Summevonmods 
                      FROM "20091229global" 
                      GROUP BY proddate, site, plant, pid 
                      HAVING proddate &gt; Date('today') - 14
                      AND
                      site='"""+self.site[i]+"""'
                      AND
                      pid=802
                      AND
                      plant='"""+str(self.plant[j])+"""' 
                      ORDER BY proddate, site, plant, pid; 
                      """)
  
              self.row = self.cur.fetchone()
  
              while self.row:
                  self.datProd1.append(self.row[0])
                  self.datProd2.append(self.row[1])
  
                  pylab.title('Progress of %s' %self.site[i])
                  pylab.ylabel('number')
                  pylab.xlabel('date')
                  pylab.plot(self.datProd1, self.datProd2)
                  pylab.savefig("bild%i" %i )
  
                  self.row=self.cur.fetchone()
  
  q = Datenanzeige()
  q.anzeige()
  </code></pre>
  
  <p>the code is working. i get for every self.site variable another picture but every following picture includes the lines of the former one. how can i prevent this?
  i need separate pictures without lines of the former one.</p>