title: Putting the legend outside the plot in pyplot and pandas
body: <p>I am trying to get my legend outside the plot but some of its gets cropped.</p>
  
  <p>My data:</p>
  
  <pre><code>Origin  China   India   Pakistan    Philippines United Kingdom of Great Britain and Northern Ireland
  Year                    
  1980    5123    8880    978 6051    22045
  1981    6682    8670    972 5921    24796
  1982    3308    8147    1201    5249    20620
  1983    1863    7338    900 4562    10015
  1984    1527    5704    668 3801    10170
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>top_5.plot(kind = 'line', figsize=(10, 6)).legend(loc='center left', bbox_to_anchor=(1, 0.5))
  plt.title('Top 5 Countries in Terms of Origin of Immigrants to Canada')
  plt.xlabel('Year')
  plt.ylabel('Number of Immigrants')
  plt.show()
  </code></pre>
  
  <p>The output:</p>
  
  <p><a href="https://i.stack.imgur.com/PBAVA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PBAVA.jpg" alt="enter image description here"></a></p>