Figure.legend(*args, loc='r', width=None, space=None, row=None, col=None, rows=None, cols=None, span=None, **kwargs)[source]

Draw a legend along the left, right, bottom, or top side of the figure, centered between the leftmost and rightmost (or topmost and bottommost) main axes.

  • loc (str, optional) – The legend location. Valid location keys are as follows.


    Valid keys

    left edge

    'l', 'left'

    right edge

    'r', 'right'

    bottom edge

    'b', 'bottom'

    top edge

    't', 'top'

  • row, rows (optional) – Aliases for span for panels on the left or right side.

  • col, cols (optional) – Aliases for span for panels on the top or bottom side.

  • span (int or (int, int), optional) – Describes how the legend spans rows and columns of subplots. For example, fig.legend(loc='b', col=1) draws a legend beneath the leftmost column of subplots, and fig.legend(loc='b', cols=(1,2)) draws a legend beneath the left two columns of subplots. By default, the legend will span all rows and columns.

  • space (float or str, optional) – The space between the main subplot grid and the legend, or the space between successively stacked colorbars. Units are interpreted by units. By default, this is adjusted automatically in the “tight layout” calculation, or is rc[‘subplots.panelpad’] = '0.5em' if “tight layout” is turned off.

Other Parameters

*args, **kwargs – Passed to legend_wrapper.