seaborn.FacetGrid.add_legend#

FacetGrid.add_legend(legend_data=None, title=None, label_order=None, adjust_subtitles=False, **kwargs)#

Draw a legend, maybe placing it outside axes and resizing the figure.

Parameters:
legend_datadict

Dictionary mapping label names (or two-element tuples where the second element is a label name) to matplotlib artist handles. The default reads from self._legend_data.

titlestring

Title for the legend. The default reads from self._hue_var.

label_orderlist of labels

The order that the legend entries should appear in. The default reads from self.hue_names.

adjust_subtitlesbool

If True, modify entries with invisible artists to left-align the labels and set the font size to that of a title.

kwargskey, value pairings

Other keyword arguments are passed to the underlying legend methods on the Figure or Axes object.

Returns:
selfGrid instance

Returns self for easy chaining.