__init__(self, parent, handles, labels, loc=None, numpoints=None, markerscale=None, markerfirst=True, scatterpoints=None, scatteryoffsets=None, prop=None, fontsize=None, labelcolor=None, borderpad=None, labelspacing=None, handlelength=None, handleheight=None, handletextpad=None, borderaxespad=None, columnspacing=None, ncol=1, mode=None, fancybox=None, shadow=None, title=None, title_fontsize=None, framealpha=None, edgecolor=None, facecolor=None, bbox_to_anchor=None, bbox_transform=None, frameon=None, handler_map=None, title_fontproperties=None)
Users can specify any arbitrary location for the legend using the bbox_to_anchor keyword argument. bbox_to_anchor can be a .BboxBase
(or derived there from) or a tuple of 2 or 4 floats. See set_bbox_to_anchor
for more detail.
The legend location can be specified by setting loc with a tuple of 2 floats, which is interpreted as the lower-left corner of the legend in the normalized axes coordinate.
The location of the legend.
The strings 'upper left', 'upper right', 'lower left', 'lower right'
place the legend at the corresponding corner of the axes/figure.
The strings 'upper center', 'lower center', 'center left', 'center right'
place the legend at the center of the corresponding edge of the axes/figure.
The string 'center'
places the legend at the center of the axes/figure.
The string 'best'
places the legend at the location, among the nine locations defined so far, with the minimum overlap with other drawn artists. This option can be quite slow for plots with large amounts of data; your plotting speed may benefit from providing a specific location.
The location can also be a 2-tuple giving the coordinates of the lower-left corner of the legend in axes coordinates (in which case bbox_to_anchor will be ignored).
For back-compatibility, 'center right'
(but no other location) can also be spelled 'right'
, and each "string" locations can also be given as a numeric value:
=============== ============= Location String Location Code =============== ============= 'best' 0 'upper right' 1 'upper left' 2 'lower left' 3 'lower right' 4 'right' 5 'center left' 6 'center right' 7 'lower center' 8 'upper center' 9 'center' 10 =============== =============
Box that is used to position the legend in conjunction with loc. Defaults to :None:None:`axes.bbox`
(if called as a method to .Axes.legend
) or :None:None:`figure.bbox`
(if :None:None:`.Figure.legend`
). This argument allows arbitrary placement of the legend.
Bbox coordinates are interpreted in the coordinate system given by bbox_transform, with the default transform Axes or Figure coordinates, depending on which legend
is called.
If a 4-tuple or .BboxBase
is given, then it specifies the bbox (x, y, width, height)
that the legend is placed in. To put the legend in the best location in the bottom right quadrant of the axes (or figure):
loc='best', bbox_to_anchor=(0.5, 0., 0.5, 0.5)
A 2-tuple (x, y)
places the corner of the legend specified by loc at x, y. For example, to put the legend's upper right-hand corner in the center of the axes (or figure) the following keywords can be used:
loc='upper right', bbox_to_anchor=(0.5, 0.5)
The number of columns that the legend has.
The font properties of the legend. If None (default), the current matplotlib.rcParams
will be used.
The font size of the legend. If the value is numeric the size will be the absolute font size in points. String values are relative to the current default font size. This argument is only used if prop is not specified.
The color of the text in the legend. Either a valid color string (for example, 'red'), or a list of color strings. The labelcolor can also be made to match the color of the line or marker using 'linecolor', 'markerfacecolor' (or 'mfc'), or 'markeredgecolor' (or 'mec').
Labelcolor can be set globally using legend.labelcolor
. If None, use text.color
.
The number of marker points in the legend when creating a legend entry for a .Line2D
(line).
The number of marker points in the legend when creating a legend entry for a .PathCollection
(scatter plot).
The vertical offset (relative to the font size) for the markers created for a scatter plot legend entry. 0.0 is at the base the legend text, and 1.0 is at the top. To draw all markers at the same height, set to [0.5]
.
The relative size of legend markers compared with the originally drawn ones.
If True, legend marker is placed to the left of the legend label. If False, legend marker is placed to the right of the legend label.
Whether the legend should be drawn on a patch (frame).
Whether round edges should be enabled around the .FancyBboxPatch
which makes up the legend's background.
Whether to draw a shadow behind the legend.
The alpha transparency of the legend's background. If shadow is activated and framealpha is None
, the default value is ignored.
The legend's background color. If "inherit"
, use axes.facecolor
.
The legend's background patch edge color. If "inherit"
, use take axes.edgecolor
.
If mode is set to "expand"
the legend will be horizontally expanded to fill the axes area (or bbox_to_anchor if defines the legend's size).
The transform for the bounding box (bbox_to_anchor). For a value of None
(default) the Axes' ~matplotlib.axes.Axes.transAxes
transform will be used.
The legend's title. Default is no title ( None
).
The font properties of the legend's title. If None (default), the title_fontsize argument will be used if present; if title_fontsize is also None, the current legend.title_fontsize
will be used.
The font size of the legend's title. Note: This cannot be combined with title_fontproperties. If you want to set the fontsize alongside other font properties, use the size parameter in title_fontproperties.
The fractional whitespace inside the legend border, in font-size units.
The vertical space between the legend entries, in font-size units.
The length of the legend handles, in font-size units.
The height of the legend handles, in font-size units.
The pad between the legend handle and text, in font-size units.
The pad between the axes and legend border, in font-size units.
The spacing between columns, in font-size units.
The custom dictionary mapping instances or types to a legend handler. This handler_map updates the default handler map found at matplotlib.legend.Legend.get_legend_handler_map
.
The artist that contains the legend.
A list of Artists (lines, patches) to be added to the legend.
A list of labels to show next to the artists. The length of handles and labels should be the same. If they are not, they are truncated to the smaller of both lengths.
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them