title: python - repositioning my legend using loc
body: <p>this is the output of my code</p>
  <p><a href="https://i.stack.imgur.com/Y0Qkx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Y0Qkx.png" alt="enter image description here" /></a></p>
  <p>as you can see both legends 'pl' and 'ppl' are overlapping at the top right. How do I get one of them to move to top left.
  I tried searching for ans, and used &quot;loc&quot; to fix the issue, somehow I continue getting error. Can someone help please?</p>
  <pre><code>import numpy as np
  import pandas as pd
  import matplotlib.pyplot as plt
  
  fig = plt.figure()
  ax1 = fig.add_subplot(111)
  ax2 = ax1.twinx()
  ax1.set_xlabel('Date')
  ax1.set_ylabel('percent change / 100')
  dd = pd.DataFrame(np.random.randint(1,10,(30,2)),columns=['pl','ppl'])
  dd['pl'].plot(ax=ax1,legend=True)
  dd['ppl'].plot(ax=ax2, style=['g--', 'b--', 'r--'],legend=True)
  
  ax2.set_ylabel('difference')
  plt.show()
  </code></pre>