legend_extras¶
- legend_extras(self, handles=None, labels=None, *, loc=None, ncol=None, ncols=None, center=None, order='C', label=None, title=None, fontsize=None, fontweight=None, fontcolor=None, color=None, marker=None, lw=None, linewidth=None, dashes=None, linestyle=None, markersize=None, frameon=None, frame=None, **kwargs)[source]¶
Adds useful features for controlling legends, including “centered-row” legends.
Important
This function wraps
proplot.axes.Axes.legendandproplot.figure.Figure.legend.- Parameters
handles (list of
Artist, optional) – List of artists instances, or list of lists of artist instances (see thecenterkeyword). IfNone, the artists are retrieved withget_legend_handles_labels.labels (list of str, optional) – Matching list of string labels, or list of lists of string labels (see the
centerkeywod). IfNone, the labels are retrieved by callingget_labelon eachArtistinhandles.loc (int or str, optional) – The legend location. The following location keys are valid:
Location
Valid keys
“best” possible
0,'best','b','i','inset'upper right
1,'upper right','ur'upper left
2,'upper left','ul'lower left
3,'lower left','ll'lower right
4,'lower right','lr'center left
5,'center left','cl'center right
6,'center right','cr'lower center
7,'lower center','lc'upper center
8,'upper center','uc'center
9,'center','c'ncol, ncols (int, optional) – The number of columns.
ncolsis an alias, added for consistency withsubplots.order ({‘C’, ‘F’}, optional) – Whether legend handles are drawn in row-major (
'C') or column-major ('F') order. Analagous tonumpy.arrayordering. For some reason'F'was the original matplotlib default. Default is'C'.center (bool, optional) – Whether to center each legend row individually. If
True, we actually draw successive single-row legends stacked on top of each other. IfNone, we infer this setting fromhandles. Default isTrueifhandlesis a list of lists (each sublist is used as a row in the legend). Otherwise, default isFalse.title, label (str, optional) – The legend title. The
labelkeyword is also accepted, for consistency withcolorbar.fontsize, fontweight, fontcolor (optional) – The font size, weight, and color for the legend text. The default font size is
rc[‘legend.fontsize’].color, lw, linewidth, marker, linestyle, dashes, markersize (property-spec, optional) – Properties used to override the legend handles. For example, for a legend describing variations in line style ignoring variations in color, you might want to use
color='k'. For now this does not includefacecolor,edgecolor, andalpha, becauselegenduses these keyword args to modify the frame properties.
- Other Parameters
**kwargs – Passed to
matplotlib.axes.Axes.legend.