Files
intellecton/venv/lib/python3.12/site-packages/matplotlib/__pycache__/legend.cpython-312.pyc
T

553 lines
58 KiB
Plaintext
Raw Normal View History

Ë
†Rj/Øãó(dZddlZddlZddlZddlZddlZddlZddlm Z m
Z
m Z m Z m
Z
ddlmZmZddlmZddlmZddlmZddlmZmZmZmZmZdd lmZmZm Z m!Z!m"Z"m#Z#dd
l$m%Z%dd l&m'Z'm(Z(m)Z)dd l&m*Z*m+Z+dd
l,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2ddl3m4Z4m5Z5m6Z6ddl7m8Z8Gdde.«Z9dZ:dZ;dZ<e;j{dde<d¬«e:zZ>e
j~je>¬«dZAe;j{dddeA¬«e:zZBe
j~jeB¬«e;j{dd e<eA¬«e:zZCe
j~jeC¬!«e;j{dd e<eA¬«ZDe
j~jeD¬"«Gd#„d$e«ZEd)d%„ZFd)d&„ZGddd'œd(„ZHy)*aT
The legend module defines the Legend class, which is responsible for
drawing legends associated with Axes and/or figures.
.. important::
It is unlikely that you would ever create a Legend instance manually.
Most users would normally create a legend via the `~.Axes.legend`
function. For more details on legends there is also a :ref:`legend guide
<legend_guide>`.
The `Legend` class is a container of legend handles and legend texts.
The legend handler map specifies how to create legend handles from artists
(lines, patches, etc.) in the Axes or figures. Default legend handlers are
defined in the :mod:`~matplotlib.legend_handler` module. While not all artist
types are covered by the default legend handlers, custom legend handlers can be
defined to support arbitrary objects.
See the :ref`<legend_guide>` for more
information.
éN)Ú_apiÚ
_docstringÚcbookÚcolorsÚ offsetbox)ÚArtistÚallow_rasterization)Ú silent_list)ÚFontProperties)ÚLine2D)ÚPatchÚ RectangleÚShadowÚFancyBboxPatchÚ StepPatch)Ú
CollectionÚCircleCollectionÚLineCollectionÚPathCollectionÚPolyCollectionÚRegularPolyCollection)ÚText)ÚBboxÚBboxBaseÚTransformedBbox)ÚBboxTransformToÚBboxTransformFrom)ÚAnchoredOffsetboxÚDraggableOffsetBoxÚHPackerÚVPackerÚ DrawingAreaÚTextArea)ÚErrorbarContainerÚ BarContainerÚ
StemContaineré)Úlegend_handlercó2eZdZdˆfd„ ZdZdZdZˆxZS)ÚDraggableLegendcóŒ||_tjddg|¬«||_t|||j |¬«y)
Wrapper around a `.Legend` to support mouse dragging.
Parameters
----------
legend : `.Legend`
The `.Legend` instance to wrap.
use_blit : bool, optional
Use blitting for faster image composition. For details see
:ref:`func-animation`.
update : {'loc', 'bbox'}, optional
If "loc", update the *loc* parameter of the legend upon finalizing.
If "bbox", update the *bbox_to_anchor* parameter.
ÚlocÚbbox©Úupdate)Úuse_blitN)ÚlegendrÚ
check_in_listÚ_updateÚsuperÚ__init__Ú _legend_box)Úselfr1r0r/Ú __class__s €úT/home/antigravity/intellecton/venv/lib/python3.12/site-packages/matplotlib/legend.pyr5zDraggableLegend.__init__7sAø€ðˆŒ ä ×јE 6˜?°6ÕˆŒ ä
ј ×!3Ñ!3¸hÐÕcóÀ|jdk(r |j|j««y|jdk(r |j|j««yy)Nr,r-)r3Ú _update_locÚget_loc_in_canvasÚ_update_bbox_to_anchor©r7s r9Úfinalize_offsetzDraggableLegend.finalize_offsetMsMØ <‰<˜ Ø × Ñ ˜T×
\‰\˜
× ×(>Ñ(>Ó(@Õ $r:cóF|jj«}|jdk(s|jdk(r5|jj d«|jj«}t |«}t
|j|««|j_y)Nr) r1Úget_bbox_to_anchorÚwidthÚheightÚset_bbox_to_anchorrÚtupleÚ transformÚ_loc)r7Ú
loc_in_canvasr-Ú_bbox_transforms r9r<zDraggableLegend._update_locSsvØ{‰{×ð :‰:˜Š?˜dŸk™k¨QÒ K‰K× *¨4Ô —;‘;×3ˆDÜ+¨DÓ1ˆÜ  ×!:Ñ!:¸=Ó!IÓJˆ Õr:có˜|jjjj|«}|jj |«y©N)r1ÚaxesÚ transAxesrGrE)r7rIÚ loc_in_bboxs r9r>z&DraggableLegend._update_bbox_to_anchor]s4Ø—kk×&×0×:¸Iˆ Ø ×& 3r:©Fr,)Ú__name__Ú
__module__Ú __qualname__r5r@r<r>Ú
__classcell__©r8s@r9r*r*6sø„õHò,Bò Kö4r:r*a9
bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
Box that is used to position the legend in conjunction with *loc*.
Defaults to ``axes.bbox`` (if called as a method to `.Axes.legend`) or
``figure.bbox`` (if ``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)
ncols : int, default: 1
The number of columns that the legend has.
For backward compatibility, the spelling *ncol* is also supported
but it is discouraged. If both are given, *ncols* takes precedence.
prop : None or `~matplotlib.font_manager.FontProperties` or dict
The font properties of the legend. If None (default), the current
:data:`matplotlib.rcParams` will be used.
fontsize : int or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
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.
labelcolor : str or list, default: :rc:`legend.labelcolor`
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 :rc:`legend.labelcolor`. If None,
use :rc:`text.color`.
numpoints : int, default: :rc:`legend.numpoints`
The number of marker points in the legend when creating a legend
entry for a `.Line2D` (line).
scatterpoints : int, default: :rc:`legend.scatterpoints`
The number of marker points in the legend when creating
a legend entry for a `.PathCollection` (scatter plot).
scatteryoffsets : iterable of floats, default: ``[0.375, 0.5, 0.3125]``
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]``.
markerscale : float, default: :rc:`legend.markerscale`
The relative size of legend markers compared to the originally drawn ones.
markerfirst : bool, default: True
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.
reverse : bool, default: False
If *True*, the legend labels are displayed in reverse order from the input.
If *False*, the legend labels are displayed in the same order as the input.
.. versionadded:: 3.7
frameon : bool, default: :rc:`legend.frameon`
Whether the legend should be drawn on a patch (frame).
fancybox : bool, default: :rc:`legend.fancybox`
Whether round edges should be enabled around the `.FancyBboxPatch` which
makes up the legend's background.
shadow : None, bool or dict, default: :rc:`legend.shadow`
Whether to draw a shadow behind the legend.
The shadow can be configured using `.Patch` keywords.
Customization via :rc:`legend.shadow` is currently not supported.
framealpha : float, default: :rc:`legend.framealpha`
The alpha transparency of the legend's background.
If *shadow* is activated and *framealpha* is ``None``, the default value is
ignored.
facecolor : "inherit" or color, default: :rc:`legend.facecolor`
The legend's background color.
If ``"inherit"``, use :rc:`axes.facecolor`.
edgecolor : "inherit" or color, default: :rc:`legend.edgecolor`
The legend's background patch edge color.
If ``"inherit"``, use :rc:`axes.edgecolor`.
mode : {"expand", None}
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).
bbox_transform : None or `~matplotlib.transforms.Transform`
The transform for the bounding box (*bbox_to_anchor*). For a value
of ``None`` (default) the Axes'
:data:`~matplotlib.axes.Axes.transAxes` transform will be used.
title : str or None
The legend's title. Default is no title (``None``).
title_fontproperties : None or `~matplotlib.font_manager.FontProperties` or dict
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 :rc:`legend.title_fontsize` will be used.
title_fontsize : int or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}, default: :rc:`legend.title_fontsize`
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*.
alignment : {'center', 'left', 'right'}, default: 'center'
The alignment of the legend title and the box of entries. The entries
are aligned as a single block, so that markers always lined up.
borderpad : float, default: :rc:`legend.borderpad`
The fractional whitespace inside the legend border, in font-size units.
labelspacing : float, default: :rc:`legend.labelspacing`
The vertical space between the legend entries, in font-size units.
handlelength : float, default: :rc:`legend.handlelength`
The length of the legend handles, in font-size units.
handleheight : float, default: :rc:`legend.handleheight`
The height of the legend handles, in font-size units.
handletextpad : float, default: :rc:`legend.handletextpad`
The pad between the legend handle and text, in font-size units.
borderaxespad : float, default: :rc:`legend.borderaxespad`
The pad between the Axes and legend border, in font-size units.
columnspacing : float, default: :rc:`legend.columnspacing`
The spacing between columns, in font-size units.
handler_map : dict or None
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`.
draggable : bool, default: False
Whether the legend can be dragged with the mouse.
a4
loc : str or pair of floats, default: {default}
The location of the legend.
The strings ``'upper left'``, ``'upper right'``, ``'lower left'``,
``'lower right'`` place the legend at the corresponding corner of the
{parent}.
The strings ``'upper center'``, ``'lower center'``, ``'center left'``,
``'center right'`` place the legend at the center of the corresponding edge
of the {parent}.
The string ``'center'`` places the legend at the center of the {parent}.
{best}
The location can also be a 2-tuple giving the coordinates of the lower-left
corner of the legend in {parent} 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" location can also be given as a
numeric value:
================== =============
Location String Location Code
================== =============
'best' (Axes only) 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
================== =============
{outside}a/
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.
rMz:rc:`legend.loc`Ú)ÚparentÚdefaultÚbestÚoutside)Ú_legend_kw_axesaX
If a figure is using the constrained layout manager, the string codes
of the *loc* keyword argument can get better layout behaviour using the
prefix 'outside'. There is ambiguity at the corners, so 'outside
upper right' will make space for the legend above the rest of the
axes in the layout, and 'outside right upper' will make space on the
right side of the layout. In addition to the values of *loc*
listed above, we have 'outside right upper', 'outside right lower',
'outside left upper', and 'outside left lower'. See
:ref:`legend_guide` for more details.
Úfigurez
'upper right')Ú_legend_kw_figurez axes/figurez3:rc:`legend.loc` for Axes, 'upper right' for Figure)Ú_legend_kw_doc)Ú_legend_kw_set_loc_docc$ó¦eZdZdZddiej
¥ZdZdZejdddddddddddddddddd dddddddddddddd
d dd œ"ˆfd
«Z
d
Z ejd0d«Z dZ
dZdZeee
«ZdZed«Zeej.«eej2«eej6«eej:«eej>«e ejB«e"ejF«e$ejJ«e&ej:ejN¬«e(ejR«e*ejV«e,ejZ«i Z.e/d«Z0e/d«Z1e/d«Z2dZ3e4d«Z5d1dZ6dZ7dZ8dZ9dZ:dZ;d „Z<d!„Z=d"„Z>d0d#„Z?d$„Z@d0d%„ZAd0d&„ZBd'„ZCd(„ZDeDZEd)„ZFd0d*„ZGd+„ZHd,„ZId-„ZJd2d.„ZKd/„ZLˆxZMS)3ÚLegendz,
Place a legend on the figure/axes.
rYrécóy)Nra©r?s r9Ú__str__zLegend.__str___sØr:NTFr'Úcenter)"r,Ú numpointsÚ markerscaleÚ markerfirstÚreverseÚ
scatterpointsÚscatteryoffsetsÚpropÚfontsizeÚ
labelcolorÚ borderpadÚ labelspacingÚ handlelengthÚ handleheightÚ
handletextpadÚ
borderaxespadÚ
columnspacingÚncolsÚmodeÚfancyboxÚshadowÚtitleÚtitle_fontsizeÚ
framealphaÚ edgecolorÚ facecolorÚbbox_to_anchorÚbbox_transformÚframeonÚ handler_mapÚtitle_fontpropertiesÚ alignmentÚncolÚ draggablec"ó>ddlm}&ddlm}'t‰0|«| €&t
tj| d«¬«|_ nZt
j| «|_ t| t«r0d| vr,|jjtjd«|jj«|_g|_g|_d|_|!|_tj|d«|_tj|d «|_tj| d
«|_tj|d «|_tj|d «|_tj|d
«|_tj|d«|_tj|d«|_tj|d«|_tj|d«|_tj|d«|_|rgtA|«¢}gtA|«¢}tC|«}tE|«dkrd}|dk7r|n|$|_#|j*dkrtId|z«|
tKjLgd¢«|_'ntKjP|
«|_'|j.tE|jN«zdz}(tKjR|jN|(«d|j.|_'d|_*t||&«r0d|_+||_,|j[|j]d¬««n0t||'«rd|_+|j[|«n t_d«||_0||_1|je||«dddœ|_3t|j>t«r-|jfji|j>«d|_nX|j>dvrtk|j>«|_n/tId|j>dtm|j>«d «tj|d!«}|d"k(rtjd#}tj|d$«}|d"k(rtjd%}tj|d&«}tod'dd||||n|rdntjd(|rd)nd*|j dtj| d+«¬,«
|_8|js|jp«tujvgd-¢|#¬.«|#|_<|j{|||«|j}|«|
|" tId/«t
j|"«})t|"t«r)d|"vrmtjd0}|)j|«nH||)j|«n4t|"t «s$tjd0}|)j|«|j||)¬1«d|_@||%¬2«d3d4gd5d4gd5d4gd6d7gd6d7gd8œ}*tj|
d9«}
|
tjd:}
t|
t„«rÙ|
|*vrÕ|*|
}+t‡|j$|j"«D\},}- |,j‰«Œ |+D]}. t|,|.««}/t|/tJ«rO|/jddk(s'tKj|/|/d«j•«r|-j—|/d«nn|-j—|/«Œ¬Œ®yt™|
d;«r#|j"D]}-|-j—|
«ŒytK|
«rVt‡|j"j |
«««D]\}-}/|-j—|/«ŒytId<|
«#$rYŒUwxYw#$rYŒcwxYw)=a÷
Parameters
----------
parent : `~matplotlib.axes.Axes` or `.Figure`
The artist that contains the legend.
handles : list of (`.Artist` or tuple of `.Artist`)
A list of Artists (lines, patches) to be added to the legend.
labels : list of str
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 length of the shorter list.
Other Parameters
----------------
%(_legend_kw_doc)s
Attributes
----------
legend_handles
List of `.Artist` objects added as legend entries.
.. versionadded:: 3.7
r)ÚAxes)Ú
FigureBaseNzlegend.fontsize)Úsizerzlegend.numpointszlegend.markerscalezlegend.scatterpointszlegend.borderpadzlegend.labelspacingzlegend.handlelengthzlegend.handleheightzlegend.handletextpadzlegend.borderaxespadzlegend.columnspacingz
legend.shadowér'z numpoints must be > 0; it was %d)gØ?gà?gÔ?TF©Úrootz0Legend needs either Axes or FigureBase as parentéþÿÿÿ)ÚoxÚoy)rr'TFz*Legend shadow must be a dict or bool, not z of type ú.zlegend.facecolorÚinheritzaxes.facecolorzlegend.edgecolorzaxes.edgecolorzlegend.fancybox)rrzlegend.framealphazround,pad=0,rounding_size=0.2z square,pad=0zlegend.frameon)
ÚxyrCrDrr~ÚalphaÚboxstyleÚmutation_scaleÚsnapÚvisible©rfÚleftÚright©r…zctitle_fontsize and title_fontproperties can't be specified at the same time. Only use one of them. zlegend.title_fontsize)rm)ÚstateÚ get_colorÚ
get_facecolorÚget_markerfacecolorÚget_markeredgecolorÚ
get_edgecolor)Ú linecolorÚmarkerfacecolorÚmfcÚmarkeredgecolorÚmeczlegend.labelcolorz
text.colorÚnonezInvalid labelcolor: )SÚmatplotlib.axesr‰Úmatplotlib.figurerŠr4r5r ÚmplÚ
_val_or_rcrmÚ _from_anyÚ
isinstanceÚdictÚset_sizeÚrcParamsÚget_size_in_pointsÚ _fontsizeÚtextsÚlegend_handlesÚ_legend_title_boxÚ_custom_handler_maprgrhrkrprqrrrsrtrurvrzÚreversedÚlistÚlenÚ_ncolsÚ
ValueErrorÚnpÚarrayÚ_scatteryoffsetsÚasarrayÚtiler6ÚisaxesrMÚ
set_figureÚ
get_figureÚ TypeErrorrWÚ_moderEÚ
_shadow_propsr/ÚboolÚtyperÚ legendPatchÚ_set_artist_propsrr2Ú
_alignmentÚ_init_legend_boxÚset_locÚ set_titleÚ
_draggableÚ
set_draggableÚstrÚzipÚ get_arrayÚAttributeErrorÚgetattrÚndarrayÚshapeÚiscloseÚallÚ set_colorrÚ
_str_equalÚiterableÚ itertoolsÚcyclerÚ
to_rgba_array)1r7rWÚhandlesÚlabelsr,rgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|r}r~rr€rrr„r…r†r‡r‰ÚrepsÚ
title_prop_fpÚ
color_gettersÚ getter_namesÚhandleÚtextÚ getter_nameÚcolorr8s1 €r9r5zLegend.__init__bs;ø€õL
ÑÔà ˆ&¬C¯N©N¸8ÐEVÓ,WÔXˆD&×Ó6ˆDŒIܘÔ%¨&¸Ñ*<Ø ×"¤3§<¡<Ð0AÑ#BÔŸ×ŒàˆŒ
Ø ˆÔØ!%ˆÔð$/ˆÔ 䟨 Ð3Eӌܟ>™>¨+Ð7KÓLˆÔÜ Ÿ^™^¨MÐ;QÓÔÜŸ¨ Ð3EӌܟN™N¨<Ð9NÓOˆÔÜŸN™N¨<Ð9NÓOˆÔÜŸN™N¨<Ð9NÓOˆÔÜ Ÿ^™^¨MÐ;QÓÔÜ Ÿ^™^¨MÐ;QÓÔÜ Ÿ^™^¨MÐ;QÓÔÜ—n‘n V¨_ÓŒ á Ø(”x Ó(ˆ Ó*ˆw“-ˆÜ ˆw‹<˜!Ò ØˆEØšze¨tˆŒ à >‰>˜ ÜÐ?À)Ñ  Ð "Ü$&§H¡HÒ-IÓ$Jˆ !ä$&§J¡J¨Ó$?ˆ ×!¤S¨×)>Ñ)>Ó%?Ñ?À!ÑCˆÜ "§¡¨×(=Ñ(=Ø(,ó!.Ø.A¨t×/AÑ/Að!CˆÔð  ˆÔä f˜dÔ ˆDŒK؈DŒIØ O‰O˜F×-°5Ð
˜ 
Ô
ˆDŒKØ O‰O˜FÕ Øð
ðˆŒ àˆŒ
Ø ×Ñ °Ô %&¨RÑ0ˆÔÜ d—k‘k¤4Ô × Ñ × % d§k¡kÔ ˆD
[‰[Ð
˜tŸ{™{Ó+ˆDØ—;;/ ¬4°· ± Ó+<Ð*=¸@óð
ô—N‘N 9Ð.@ÓAˆ Ø ˜ Ò Ÿ Ð%5Ñ6ˆIä—N‘N 9Ð.@ÓAˆ Ø ˜ Ò Ÿ Ð%5Ñ6ˆ—>> (Ð,=Ó>ˆä˜Q ¨9à!+Ð!7‘:Ù#™ÜŸ Ð%8Ñ:BÑŸ>™>ØÜ—NN 7Ð,<Ó
ˆÔð
×јt× ×ÑÒ6À)ÕŒð
×јg v¨{Ô
ð Ð %Ð*>Ð*JÜð
'×0Ð1EÓFˆ
Ü Ð*¬DÔ Ð1Ü!$§¡Ð.EÑ!FØ×& 
Ð
× "  Ð0´ Ÿ\™\Ð*AÑBˆ × "   u ÔˆŒØ ×Ñ ÐÔ
!,°ÐGØ 5°ÐGØ 5°ÐGØ 5°ÐGØ 5°Ð 
ˆ
ô—^^ JÐ0CÓDˆ
Ø Ð ÜŸ lÑ3ˆJÜ j¤#Ô &¨:¸Ñ+FØÑ4ˆLÜ # D×$7Ñ$7¸¿¹Ó Dò
 ˜ðØ× ð$0òØ <¤¨° Ó <Ó >˜Ü% e¬R¯Z©ZÔ8à$)§K¡K°¡N°aÒ$7Ü')§z¡z°%¸¸Ó'B×'FÑ'FÔ'Hà $§¡¨u°Q©xÕ 8à $à ŸN™N¨5Ôññ

ô,×
Ñ
˜j¨&Ô
Ÿ
ò
+ؘ
[‰[˜Ô
" 4§:¡:Ü#,§?¡?Ü'-×';Ñ';¸JÓ'Gó$Ió Jò
& ˜
Ð3°J°>Ð Cøô7Úðûô Úðús%Ú$_?Ú<B `ß? ` à ` à `à`có¾|j|jd¬««|jr|j|_|j |j ««y)zF
Set the boilerplate props for artists added to Axes.
FrN)rMÚ
set_transformÚ
get_transform)r7Úas r9zLegend._set_artist_propsosBð
T—_‘_¨% ;Š;Ø—Y‘YˆAŒFà ˜×-r:cóô|}|du|_|€%tjd}|js|dvrd}d|}d|_t |t «rÈ|j«ddk(r|jd«d }|jd
d «|_|jj«d|_|j«}t|«d kDr%|dd vr|dd
k7r|ddd}|ddz|d z}tj|j|¬«}n{tj|«r6t|«}t|«dk7st!d|D««s;t#|«t |t$«r|dks|dkDrt#|«t#|«|jr|jrt#d|d«|js|dk(r t#d«|j}|j'|«||_y)
Set the location of the legend.
.. versionadded:: 3.8
Parameters
----------
%(_legend_kw_set_loc_doc)s
Nz
legend.loc)rrYz upper rightz>loc must be string, coordinate tuple, or an integer 0-10, not rrZzoutside r'zcenter rV)rrféÿÿÿÿú )r,c3óPK|]}t|tj«Œ y­wrL)ÚnumbersÚReal)Ú.0Úes r9ú <genexpr>z!Legend.set_loc.<locals>.<genexpr>¤sèø€Ò'QȬ
°1´g·l±l×(CÑ'Qùs$&é
z'outside' option for loc='z0' keyword argument only works for figure legendszIAutomatic legend placement (loc='best') not implemented for figure legend)Ú_loc_used_defaultr¬Ú _outside_locr¯ÚsplitÚreplacer»rÚ
check_getitemÚcodesr¾rFÚintÚ_set_loc)r7r,Úloc0Útype_err_messageÚlocsÚtmps r9zLegend.set_locyðˆØ!$¨ ˆÔØ ˆ;Ü—,‘,˜|Ñ,ˆCØ—;’; 3¨+Ñ#5Ø#ð5Ø58°GððÔÜ cœ3Ô Øy‰y‹{˜1‰~ Ò—i
Ó+¨AÑ.à$'§K¡K° ¸2Ó$>Ô!à$(×$5Ñ$5×$;Ñ$;Ó$=¸aÑ$@Ô—yy“{Üt“9˜q’= T¨!¡WÐ0AÑ%Aà˜Aw #¡D b D™z˜Ø˜q™' C™-¨$¨q©'Ñ1×$ T§Z¡Z°SÔ9‰CÜ
[‰[˜Ô
䘓*ˆ3x˜1Š}¤CÑ'QÈSÔ'QÔ$QÜ Ð!1Ó
˜œSÔ
QŠw˜# š(Ü Ð!1ÓÐ ;Š;˜4ר,¨T¨Fð3+ð
{Š{˜s ašxÜð ó
×$ˆØ
Ø!$ˆÕr:cóxd|_||_d|_|jj |j
«y)NFT)Ú _loc_realÚstaler6Ú
set_offsetÚ _findoffset)r7r,s r9rzLegend._set_loc¼s4ð"'ˆÔ؈ŒØˆŒ
Ø ×Ñ×# D×$4Ñ$4Õ5r:có||_y)zSet the number of columns.N))r7rws r9Ú set_ncolszLegend.set_ncolsÅs àˆ r:có|jSrL)rr?s r9Ú_get_loczLegend._get_locÉs Ø~‰~Ðr:cóô|jdk(r|j|||«\}}nÉ|jtjj «vrHt j dd||«}|j|j||j«|«\}}nW|j\} }
|j«}|j|j| zz|j|j|
zz}}||z||zfS)z%Helper function to locate the legend.r)
rHÚ_find_best_positionrarÿÚvaluesrÚ from_boundsÚ_get_anchored_bboxrBÚx0rCÚy0rD) r7rCrDÚxdescentÚydescentÚrendererÚyr-ÚfxÚfys r9r
zLegend._findoffsetÎð 9‰9˜Š>Ø×+¨E°6¸D‰DˆA‰qØ
Y‰Yœ&Ÿ,™,×
×# A q¨%°Ó8ˆDØ×*¨4¯9©9°dØ+/×+BÑ+BÓ+DØ+3ó5‰DˆA‰qð—Y‘Y‰FˆBØ×,ˆ—77˜TŸZ™Z¨"™_Ñ,¨d¯g©g¸¿ ¹ ÀbÑ8HÑ.HˆqˆAà8‰|˜Q ™\Ð)r:có,|j«sy|jd|j«¬«|j|j«}|j
dvrUd|j |jzz|z}|jj|j«j|z
«|jj|«}|jj|j«|jj!|«|j"r/t%|jfi|j&¤Žj)|«|jj)|«|jj)|«|j+d«d|_y)Nr1)Úgid)ÚexpandrŒF)Ú get_visibleÚ
open_groupÚget_gidÚpoints_to_pixelsr´rurpr6Ú set_widthrBrCÚget_window_extentrËÚ
set_boundsÚboundsÚset_mutation_scalerzrÚdrawÚ close_groupr)r7rrnÚpadr-s r9r)z Legend.drawßsBð×ÑÔ à×јH¨$¯,©,«.ÐÔ×,¨T¯^©^Óð :‰:˜Ñ )¨D¯N©NÑ;¸hÑFˆCØ × Ñ × & t×'>Ñ'>Ó'@×'FÑ'FÈÑ'LÔ ×Ñ×1°(ÓØ ×Ñ×# D§K¡KÔ ×Ñ×+¨HÔ
;Š;Ü 4× : t×'9Ñ'9Ñ :× Ô  ×Ñ×јhÔ ×Ñ×ј×јˆ
r:)Ú update_funccó|jS)z=Return the global default handler map, shared by all legends.©Ú_default_handler_map)Úclss r9Úget_default_handler_mapzLegend.get_default_handler_mapsð×'r:có||_y)z:Set the global default handler map, shared by all legends.Nr.©r0s r9Úset_default_handler_mapzLegend.set_default_handler_maps ð$/ˆÕ r:có:|jj|«y)z=Update the global default handler map, shared by all legends.N)r/r/r3s r9Úupdate_default_handler_mapz!Legend.update_default_handler_map!sð × Ñ × Õ4r:có^|j«}|jri|¥|j¥S|S)z*Return this legend instance's handler map.)r1r¸)r7Údefault_handler_maps r9Úget_legend_handler_mapzLegend.get_legend_handler_map&s@à"×à×DÐC¨$×*BÑ*BÐ FØ1Dð Fr:có¢ ||S#ttf$rYnwxYwt|«j«D]} ||cS#t$rYŒwxYwy)a
Return a legend handler from *legend_handler_map* that
corresponds to *orig_handler*.
*legend_handler_map* should be a dictionary object (that is
returned by the get_legend_handler_map method).
It first checks if the *orig_handle* itself is a key in the
*legend_handler_map* and return the associated value.
Otherwise, it checks for each of the classes in its
method-resolution-order. If no matching key is found, it
returns ``None``.
N)ÚKeyErrorrÊÚmro)Úlegend_handler_mapÚ orig_handleÚ handle_types r9Úget_legend_handlerzLegend.get_legend_handler,smð Ø%  2øÜœ8Ð Ù ð úä  Ó ˆKð
Ø)¨+Ñ6øÜò
Ùð
úð ð
s˜¹AÁ A Á A c óš|j}g}g}g}d|z|jdz
z}||jz|z
} |j«}
t||«D\} } |j |
| «}
|
€>t j dt| «jd«|jd«ŒXt| dtdd|j¬ «¬
«}t|j|z| d |¬ «}|j|j«|j|
j!|| ||««|j||f«Œêg}t#t$t'j(||j*««D]i}|Dcgc])\}}t-d
|j.|z|r||gn||gd¬«Œ+}}}|rdnd}|jt1d
|j2|z||¬««Œk|j4dk(rdnd}|j6|z}t-d
|d||¬«|_td«|_t1|j<|z|j2|z|j>|j:|j8g¬«|_ |j@jC|jEd¬««|jF|j@_#||_$||_%ycc}}w)
Initialize the legend_box. The legend_box is an instance of
the OffsetBox, which is packed with legend handles and
texts. Once packed, their location is calculated during the
drawing time.
gffffffÖ?gffffffæ?Nú$Legend does not support handles for z instances.
A proxy artist may be used instead.
See: https://matplotlib.org/stable/users/explain/axes/legend_guide.html#controlling-the-legend-entriesTÚbaseliner)ÚverticalalignmentÚhorizontalalignmentÚfontproperties)ÚmultilinebaselineÚ textpropsg)rCrDrrr)r+ÚsepÚchildrenÚalignrœ)r+rIrKrJrÚfixed)r+rIrKrxrJrVFr)&r´rsr9r@rÚ
warn_externalrÊrQÚappendr#rmr"rrÚ_textÚ
legend_artistÚfilterr»Ú array_splitr¼r rtr!rqrvÚ_legend_handle_boxr·rpr6rM)r7rirnÚ text_listÚ handle_listÚhandles_and_labelsÚdescentrDr=r>ÚlabelÚhandlerÚtextboxÚ handleboxÚ columnboxÚhandles_and_labels_columnÚtÚ itemboxesr…rxrIs r9zLegend._init_legend_boxFð—>‘>ˆðˆ ؈ ØÐð˜‘/ T×%6Ñ%6¸Ñ%<Ñ=ˆØ˜D×Ñ7ˆð"×ä"% g¨vÓ"6ò @Ñ ˆK˜Ø×-Ð.@À+ÓNˆˆÜ×CÜ $ [Ó 1× :Ñ :Ð<?ð@ð×" " 5¸DÜ-1Ø9CØ;AØ6:·i±iô.AôBô
(¨d×.?Ñ.?À(Ñ.JØ/5Ø13¸G ð× Ñ  §¡Ô×" 7×#8Ñ#8¸¸{Ø9AÀ9ó$NôOà"×)¨9°gÐ*>Õ?ð7 @ð:ˆ ô
*0Ü”R—^‘^Ð$6¸¿ ¹ Ó*Fò
&?÷ @ñ"˜Q ô ! QØ%)×%7Ñ%7¸(Ñ%BÙ4?¨1¨a©&ÀaÈÀVØ'1ö@ˆ@ñ '2™
°wˆIØ × Ñ œW¨Ø)-×):Ñ):¸XÑ)EØ+4Ø.7ô

 Ÿ:™:¨Ò1‰x°wˆØ× Ñ  8Ñ+ˆÜ")¨aØ.1¸Ø/3Ø3<ô#>ˆÔô"*¨"£ˆÔÜ" t§~¡~¸Ñ'@Ø'+×'8Ñ'8¸8Ñ'CØ)-¯©Ø-1×-CÑ-CØ-1×-DÑ-Dð-FôGˆÔð
×Ñ×# D§O¡O¸ OÓ$?Ô@Ø $§ ¡ ˆ×ÑÔØˆŒ
ØÕùó7@sÅ9.Kcó¾‡ —|jsJg}g}g}|jjDŠ t‰ t«r=|j ‰ j
«j‰ j«««ŒQt‰ t«r=|j ‰ j«j‰ j«««Œžt‰ t«r=|j ‰ j
«j‰ j«««Œët‰ t«r*|jˆ fd‰ j!«D««Œ%t‰ t"«rD‰ j%«\}}}}t'|«sŒW|j|j)|««Œyt‰ t*«sŒ‹|j ‰ j-|««Œ­|||fS)aC
Return display coordinates for hit testing for "best" positioning.
Returns
-------
bboxes
List of bounding boxes of all patches.
lines
List of `.Path` corresponding to each line.
offsets
List of (x, y) offsets of all collection.
c3ó\K|]#}j«j|«Œ%y­wrL)Útransform_path)ÚpathÚartists €r9z+Legend._auto_legend_data.<locals>.<genexpr>Æs-øèø€ò=Ø!%ð3×BÀ4×=ùsƒ),)rWÚ _childrenr¯r rNrcÚget_pathrÚget_bboxÚ transformedÚget_data_transformr
rÚextendÚ get_pathsrÚ_prepare_pointsr»rGrr%)
r7rÚbboxesÚlinesÚoffsetsrGÚ transOffsetÚhoffsetsÚ_res
@r9Ú_auto_legend_datazLegend._auto_legend_dataªsuø€ð{Š{Ј{؈؈؈ؗk‘k× Bˆ˜&¤&Ô Ø×*×9¸&¿/¹/Ó:KÓNä˜F¤IÔ
Ø—O%×1°&×2KÑ2KÓ2MÓPä˜F¤EÔ Ø×*×9¸&¿/¹/Ó:KÓNä˜F¤NÔ ó=Ø)/×)9Ñ)9Ó);ô˜F¤JÔ/Ø6<×6LÑ6LÓ6NÑ3 ˜°!Üx—NN ;×#8Ñ#8¸Ó#BÖ˜F¤DÖ
˜f×6°xÓAð% Bð(u˜%r:có:|j|j«gSrL)r6Ú get_framer?s r9Ú get_childrenzLegend.get_childrenÑsà× Ñ  $§.¡.Ó"2Ð3r:có|jS)z:Return the `~.patches.Rectangle` used to frame the legend.)r?s r9rvzLegend.get_frameÕsà×ÑÐr:cób|jDcgc]}t|t«sŒ|Œc}Scc}w)z4Return the list of `~.lines.Line2D`\s in the legend.)r ©r7r^s r9Ú get_lineszLegend.get_linesÙs%à×Ha´*¸QÄÕ2GÒHùÒHs,¥,c
óttd|jDcgc]}t|t«r|Œc}«Scc}w)z5Return the list of `~.patches.Patch`\s in the legend.r
)r
r
rzs r9Ú get_patcheszLegend.get_patchesÝs;ä˜7Ø'+×':Ñ':ö5 )¨!¬UÔò 6ùò5s5
có.td|j«S)z1Return the list of `~.text.Text`\s in the legend.r)r
r?s r9Ú get_textszLegend.get_textsãsä˜6 4§:¡:Ó.r:cóftjgd¢|¬«||_||j_y)a
Set the alignment of the legend title and the box of entries.
The entries are aligned as a single block, so that markers always
lined up.
Parameters
----------
alignment : {'center', 'left', 'right'}.
rN)rr2r6rK)r7r…s r9Ú
set_alignmentzLegend.set_alignmentçs*ô
×ÑÒ6À)ÕŒØ!*ˆ×ÑÕr:có.|jjS)z)Get the alignment value of the legend box)r6rKr?s r9Ú
get_alignmentzLegend.get_alignment÷sà×Ñ×%r:có°|jjj|«|rA|jjjd«|jjd«n@|jjjd«|jjd«|%|jjj |«d|_y)
Set legend title and title style.
Parameters
----------
title : str
The legend title.
prop : `.font_manager.FontProperties` or `str` or `pathlib.Path`
The font properties of the legend title.
If a `str`, it is interpreted as a fontconfig pattern parsed by
`.FontProperties`. If a `pathlib.Path`, it is interpreted as the
absolute path to a font file.
TFN)rOÚset_textÚ set_visibleÚset_fontpropertiesr)r7r{rms r9zLegend.set_titleûð
×Ñ×-¨eÔ Ø × "× (× 4°TÔ × "× .¨tÕ × "× (× 4°UÔ × "× .¨uÔ Ð Ø × "× (× ;¸ ˆ
r:có.|jjS)z1Return the `.Text` instance for the legend title.)rOr?s r9Ú get_titlezLegend.get_titlesà×%×+r:có~|€ |jd¬«j«}|jj|¬«S)NTr)r)Ú
_get_rendererr6r%©r7rs r9r%zLegend.get_window_extents;à РبDÓAˆHØ×Ñ×1¸8ÐDr:có8|jj|«SrL)r6r%s r9Ú
get_tightbboxzLegend.get_tightbbox"sà×Ñ×1°(Ó;r:có6|jj«S)z*Get whether the legend box patch is drawn.)r r?s r9Ú get_frame_onzLegend.get_frame_on&sà×Ñ×-r:cóH|jj|«d|_y)zt
Set whether the legend box patch is drawn.
Parameters
----------
b : bool
TN)r†r)r7Úbs r9Ú set_frame_onzLegend.set_frame_on*sð
×Ñ×$ ˆ
r:có^|j|jjS|jS)z4Return the bbox that the legend will be anchored to.)Ú_bbox_to_anchorrWr-r?s r9rBzLegend.get_bbox_to_anchor7s*à × Ñ Ð —;;× × 'r:cóv|d|_yt|t«r||_n4 t|«}|dk(r |d|dddg}t
j|Ž|_|t|jj«}t|j|«|_d|_ y#t$r}t d|«|d}~wwxYw)a%
Set the bbox that the legend will be anchored to.
Parameters
----------
bbox : `~matplotlib.transforms.BboxBase` or tuple
The bounding box can be specified in the following ways:
- A `.BboxBase` instance
- A tuple of ``(left, bottom, width, height)`` in the given
transform (normalized axes coordinate if None)
- A tuple of ``(left, bottom)`` where the width and height will be
assumed to be zero.
- *None*, to remove the bbox anchoring, and use the parent bbox.
transform : `~matplotlib.transforms.Transform`, optional
A transform to apply to the bounding box. If not specified, this
will use a transform to the bounding box of the parent.