arviz_plots.PlotCollection.add_legend

arviz_plots.PlotCollection.add_legend#

PlotCollection.add_legend(dim, var_name=None, aes=None, artist_kwargs=None, title=None, **kwargs)[source]#

Add a legend for the given artist/aesthetic to the plot.

Parameters:
dimhashable

Dimension for which to generate the legend. It should have at least one aesthetic mapped to it.

var_namehashable, optional

Variable name for which to generate the legend. Unless the aes DataTree has been modified manually, the legend will be independent of the variable chosen. Defaults to the first variable with dim as dimension.

aesstr or iterable of str, optional

Specific aesthetics to take into account when generating the legend. They should all be mapped to dim.

artist_kwargsmapping, optional

Keyword arguments passed to the backend artist function used to generate the miniatures in the legend.

titlestr, optional

Legend title. Defaults to dim.

**kwargsmapping, optional

Keyword arguments passed to the backend function that generates the legend.

Returns:
legendobject

The corresponding legend object for the backend of the PlotCollection.

Warning

This method is still in early stages of experimentation and anything beyond the basic usage add_legend("dim_name") will probably change in breaking ways.