matplotlib pyplot legend location

C
figlegend( (line1, line2, line3),
           ('label1', 'label2', 'label3'),
           'upper right' )
Source

Also in C: