title: Multiple legends in matplotlib in for loop
body: <p>The following program executes fine but only one legend is displayed. How can I have all the four legends displayed? kindly see the image attached.</p>
  
  <pre><code>import matplotlib.pyplot as plt
  dct = {'list_1' : [1,2,4,3,1],'list_2' : [2,4,5,1,2],'list_3' : [1,1,3,4,6],'list_4' : [1,1,2,2,1]}
  
  xs = [0,1,2,3,4]
  
  
  for i in [1,2,3,4]:
      plt.plot(xs,dct['list_%s' %i])
      plt.legend(['%s data' %i])
  
  plt.show()
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/GFIO0.png" alt="enter image description here"></p>