Create matplotlib legend out of the figure

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2010-04-16T11:48:38Z Indexed on 2010/04/16 11:53 UTC
Read the original article Hit count: 477

Filed under:
|
|

I added the legend this way:

leg = fig.legend((l0,l1,l2,l3,l4,l5,l6), 
    ('0 Cl : r2, slope, origin',
    '1 Cl :'+str(r1b)+' , '+str(m1)+' , '+str(b1),  
    '2 Cl :'+str(r2b)+' , '+str(m2)+' , '+str(b2),  
    '3 Cl :'+str(r3b)+' , '+str(m3)+' , '+str(b3),  
    '4 Cl :'+str(r4b)+' , '+str(m4)+' , '+str(b4),  
    '5 Cl :'+str(r5b)+' , '+str(m5)+' , '+str(b5),  
    '6 Cl :'+str(r6b)+' , '+str(m6)+' , '+str(b6),  
    ),  'upper right')

but the legend appears inside the plot.

How can I tell matplotlib to put it to the right of the plot and at the right?

© Stack Overflow or respective owner

Related posts about matplotlib

Related posts about python