title: Giving different titles to plots in for-loop
body: <pre><code>import numpy as np
  import matplotlib.pyplot as plt
  
  D = 12
  n = np.arange(1,4)
  x = np.linspace(-D/2,D/2, 3000)
  I = np.array([125,300,75])
  phase = np.genfromtxt('8phases.txt')
  
  I_phase = I*phase
  
  for count,i in enumerate(I_phase):
      F = sum(m*np.cos(2*np.pi*l*x/D) for m,l in zip(i,n))
      f = plt.figure()
      ax = plt.plot(x,F)
      plt.savefig(str(count)+'.png')
  plt.show()
  </code></pre>
  
  <p>This script generates 8 plots and also saves them. I want to give all the plots different titles. Is it possible that it will read a <code>.txt</code> or Excel file (<code>.xls</code>) and take the title directly from there for each plot? For example; I have titles like these (can be saved either as <code>.txt</code> or <code>.xls</code> file):</p>
  
  <pre><code>phase_01_water
  phase_02_membrane
  phase_03_water
  phase_04_empty
  phase_05_water
  phase_06_water
  phase_07_full
  phase_08_water
  </code></pre>
  
  <p>How can I do that? The <code>'8phases.txt'</code> has the following 8 lines:</p>
  
  <pre><code>-1     1    -1
  -1     1     1
   1     1     1
   1    -1     1
  -1    -1    -1
   1     1    -1
   1    -1    -1
  -1    -1     1
  </code></pre>