title: How to anchor top right corner of Legend to top right corner of Axes in matplotlib?
body: <p>I'm trying to position the legend of a matplotlib figure exactly up in the top right corner of the axes, so that there are no tiny line sections between the edges of the legend and the edges of the axes. I'd like to do it by calling methods of a Legend object directly, like <code>Legend.set_bbox_to_anchor()</code>, but my attempts don't seem to move the legend at all.</p>
  
  <p>Here's my most recent try:</p>
  
  <pre><code>leg.set_bbox_to_anchor((1,1), transform = ax.transAxes)
  </code></pre>
  
  <p>where <code>leg</code> is the Legend object and <code>ax</code> is the parent Axes object. Do You have any ideas how can I achieve this?</p>