In addition to @ImportanceOfBeingErnest's post, I use the following line to add a legend at an absolute position in a plot.
plt.legend(bbox_to_anchor=(1.0,1.0),\
bbox_transform=plt.gcf().transFigure)
For unknown reasons, bbox_transform=fig.transFigure
does not work with me.