title: How to add a legend to each subplot
body: <p>I have 4 subplots with 4 different lines and I want to make a legend in the upper right corner of each subplot that only shows the line associated with that subplot. How do I do that? I tried <code>subplot1.legend()</code> but it throws an error.</p>
  
  <p><strong>Code for subplot1:</strong></p>
  
  <pre><code>import numpy as np
  from scipy.stats import beta
  from matplotlib import pyplot as plt
  
  figure = plt.figure("Figure")
  subplot1 = figure.add_subplot(2,2,1)
  x = np.linspace (0, 1.0, 200) 
  y1 = beta.pdf(x, 10, 7)
  subplot1.plot(x, y1, "-", label="r'$\alpha=10, \beta=7$'")
  subplot1.legend() #throws an error when I include this statement
  plt.show()
  </code></pre>