title: Python: Loop through a dataframe and create one plot for each datapoint
body: <p>The below code generates a line plot. Here x axis is common and y axis is split into two (y1 and y2), which are plotted against x. I'm using <em>savefig()</em> to save the plot as a .PNG file. </p>
  
  <p>Right now, I need images to be generated at each data points (or for each value of x), so that these images would be like frames of the original graph. I tried using '<em>Iterrows</em>' to loop through the data frame. However, this was not solved.</p>
  
  <p>PS: I inted to use these generated frames to convert into video using <em>ffmpeg</em>. <em>Animate()</em> doesn't serve my purpose here, hence not using it. Quick help would be much appreciated. </p>
  
  <p>Thanks in advance!</p>
  
  <pre><code>def MakeLineGraph(stats,title, savegraph) :
  
  x = stats[stats.columns[1]]
  y1 = stats[stats.columns[2]]
  y2 = stats[stats.columns[3]]
  xlab = list(stats)[1]
  ylab = list(stats)[0]
  
  fig = plt.figure()
  pli = plt.subplot()
  
  pli.plot(x, y1, color='g', linewidth=5.0, label='label1')
  pli.plot(x, y2, color='y', linewidth=5.0, label='label2')
  
  plt.xlabel(xlab)
  plt.ylabel(ylab)
  plt.title(title)
  
  # Removing the plot frame lines.
  ax = plt.subplot(111)
  ax.spines["top"].set_visible(False)
  ax.spines["bottom"].set_visible(False)
  ax.spines["right"].set_visible(False)
  ax.spines["left"].set_visible(False)
  
  ax.get_xaxis().tick_bottom()
  ax.get_yaxis().tick_left()
  
  leg = plt.legend()
  
  for line in leg.get_lines():
      line.set_linewidth(6)
  
  if len(x) &lt; 25:
      pli.xticks(x.tolist())
  
  plt.show()
  
  if (savegraph == True):
      fig.set_size_inches((19.2, 10.8))
      fig.savefig(image_folder + 'Progress.png', transparent=True, dpi=600)
  </code></pre>