Axes.legend¶
-
Axes.legend(*args, loc=None, width=None, space=None, **kwargs)[source]¶ Adds an inset legend or outer legend along the edge of the axes. See
legend_wrapperfor details.- Parameters
loc (int or str, optional) – The legend location or panel location. The following location keys are valid. Note that if a panel does not exist, it will be generated on-the-fly.
Location
Valid keys
left panel
'left','l'right panel
'right','r'bottom panel
'bottom','b'top panel
'top','t'“best” inset
'best','inset','i',0upper right inset
'upper right','ur',1upper left inset
'upper left','ul',2lower left inset
'lower left','ll',3lower right inset
'lower right','lr',4center left inset
'center left','cl',5center right inset
'center right','cr',6lower center inset
'lower center','lc',7upper center inset
'upper center','uc',8center inset
'center','c',9width (float or str, optional) – The space allocated for outer legends. This does nothing if
rc.tightisTrue. Units are interpreted byunits.space (float or str, optional) – The space between the axes and the legend for outer legends. Units are interpreted by
units. Whenrc.tightisTrue, this is adjusted automatically. Otherwise, defaut isrc[‘subplots.panelspace’]='1em'.
- Other Parameters
*args, **kwargs – Passed to
legend_wrapper.