I\'m creating plots using Matplotlib that I save as SVG, export to .pdf + .pdf_tex using Inkscape, and include the .pdf_tex-file in a LaTeX document.
This means tha
You may use the bbox_to_anchor
and bbox_transform
parameters to help you setting the anchor for your legend:
ax = plt.gca()
plt.legend(bbox_to_anchor=(1.1, 1.1), bbox_transform=ax.transAxes)
Note that (1.1, 1.1)
are in the axes coordinates in this example. If you wish to use the data coordinates you have to use bbox_transform=ax.transData
instead.