legend elements matplotlib code example
Example 1: position of legend matplotlib
plt.legend(loc='upper right')
Example 2: matplotlib pyplot legend location
figlegend( (line1, line2, line3),
('label1', 'label2', 'label3'),
'upper right' )