title: Matplotlib: Displaying and closing a plot using a loop
body: <p>Using Matplotlib and a for loop, is it possible to display a plot for a given period of time and then have it close when the for loop is done? </p>
  
  <p>I have tried the following, but the plot simply remains open and the loop doesn't end:</p>
  
  <pre><code>import matplotlib.pyplot as plt
  import psychopy
  
  x = [34.00,108.00,64.00,99.00,99.00,51.00]
  y = [5.00,17.00,11.00,8.00,14.00,5.00]
  
  scatter(x, y, color = "black")
  
  clock = core.Clock()
  
  while clock.getTime() &lt; 10.0:
      plt.show()
  
  plt.close()
  </code></pre>
  
  <p>Thanks</p>