
    ht                        S r SSKJr  SSKrSSKJr  SSKJr  SSK	J
r
  SSKJr  S r " S S	5      r " S
 S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S  S!\5      r " S" S#\5      r " S$ S%\5      rg)&a  
Default legend handlers.

.. important::

    This is a low-level legend API, which most end users do not need.

    We recommend that you are familiar with the :ref:`legend guide
    <legend_guide>` before reading this documentation.

Legend handlers are expected to be a callable object with a following
signature::

    legend_handler(legend, orig_handle, fontsize, handlebox)

Where *legend* is the legend itself, *orig_handle* is the original
plot, *fontsize* is the fontsize in pixels, and *handlebox* is an
`.OffsetBox` instance. Within the call, you should create relevant
artists (using relevant properties from the *legend* and/or
*orig_handle*) and add them into the *handlebox*. The artists need to
be scaled according to the *fontsize* (note that the size is in pixels,
i.e., this is dpi-scaled value).

This module includes definition of several legend handler classes
derived from the base class (HandlerBase) with the following method::

    def legend_artist(self, legend, orig_handle, fontsize, handlebox)
    )cycleN)cbook)Line2D)	Rectanglec                 t    [        [        UR                  5       5      S 5      nUb  U R                  U5        g g N)nextiterget_childrenupdate_from)tgtsrcfirst_childs      K/var/www/html/env/lib/python3.13/site-packages/matplotlib/legend_handler.pyupdate_from_first_childr   (   s3    tC,,./6K$     c                   F    \ rS rSrSrSS jrS rS rS rS r	S	 r
S
 rSrg)HandlerBase.   a  
A base class for default legend handlers.

The derived classes are meant to override *create_artists* method, which
has the following signature::

  def create_artists(self, legend, orig_handle,
                     xdescent, ydescent, width, height, fontsize,
                     trans):

The overridden method needs to create artists of the given
transform that fits in the given dimension (xdescent, ydescent,
width, height) that are scaled by fontsize if necessary.

Nc                 ,    XsU l         U l        X0l        g)a  
Parameters
----------
xpad : float, optional
    Padding in x-direction.
ypad : float, optional
    Padding in y-direction.
update_func : callable, optional
    Function for updating the legend handler properties from another
    legend handler, used by `~HandlerBase.update_prop`.
N)_xpad_ypad_update_prop_func)selfxpadypadupdate_funcs       r   __init__HandlerBase.__init__>   s     "&
DJ!,r   c                 d    U R                   c  U R                  X5        g U R                  X5        g r   )r   _default_update_propr   legend_handleorig_handles      r   _update_propHandlerBase._update_propM   s*    !!)%%mA""=>r   c                 &    UR                  U5        g r   )r   r"   s      r   r!    HandlerBase._default_update_propS   s    !!+.r   c                     U R                  X5        UR                  U5        UR                  S 5        UR                  S 5        g r   )r%   _set_artist_propsset_clip_boxset_clip_pathr   r#   r$   legends       r   update_propHandlerBase.update_propV   s:    -5  /""4(##D)r   c                     X0R                   U-  -
  nX@R                  U-  -
  nXPR                   U-  -
  nX`R                  U-  -
  nX4XV4$ r   )r   r   )r   r.   r$   xdescentydescentwidthheightfontsizes           r   adjust_drawing_areaHandlerBase.adjust_drawing_area^   sS     jj833jj833

X--**x//500r   c                    U R                  XUR                  UR                  UR                  UR                  U5      u  pVpxU R                  XXVXxX4R                  5       5      n	U	 H  n
UR                  U
5        M     U	S   $ )a  
Return the artist that this HandlerBase generates for the given
original artist/handle.

Parameters
----------
legend : `~matplotlib.legend.Legend`
    The legend for which these legend artists are being created.
orig_handle : :class:`matplotlib.artist.Artist` or similar
    The object for which these legend artists are being created.
fontsize : int
    The fontsize in pixels. The artists being created should
    be scaled according to the given fontsize.
handlebox : `~matplotlib.offsetbox.OffsetBox`
    The box which has been created to hold this legend entry's
    artists. Artists created in the `legend_artist` method must
    be added to this handlebox inside this method.

r   )r7   r2   r3   r4   r5   create_artistsget_transform
add_artist)r   r.   r$   r6   	handleboxr2   r3   r4   r5   artistsas              r   legend_artistHandlerBase.legend_artistg   s    * -1,D,D##Y%7%7)"2"2	-)E
 %%f&.%&.0G0G0IK
 A  #  qzr   c	                     [        S5      e)a  
Return the legend artists generated.

Parameters
----------
legend : `~matplotlib.legend.Legend`
    The legend for which these legend artists are being created.
orig_handle : `~matplotlib.artist.Artist` or similar
    The object for which these legend artists are being created.
xdescent, ydescent, width, height : int
    The rectangle (*xdescent*, *ydescent*, *width*, *height*) that the
    legend artists being created should fit within.
fontsize : int
    The fontsize in pixels. The legend artists being created should
    be scaled according to the given fontsize.
trans : `~matplotlib.transforms.Transform`
    The transform that is applied to the legend artists being created.
    Typically from unit coordinates in the handler box to screen
    coordinates.
zDerived must override)NotImplementedError)	r   r.   r$   r2   r3   r4   r5   r6   transs	            r   r:   HandlerBase.create_artists   s    . ""9::r   )r   r   r   )        rF   N)__name__
__module____qualname____firstlineno____doc__r   r%   r!   r/   r7   r@   r:   __static_attributes__ r   r   r   r   .   s+    -?/*1#J;r   r   c                   <   ^  \ rS rSrSrSU 4S jjrS rS rSrU =r	$ )HandlerNpoints   zE
A legend handler that shows *numpoints* points in the legend entry.
c                 >   > [         TU ]  " S0 UD6  X l        Xl        g)z
Parameters
----------
marker_pad : float
    Padding between points in legend entry.
numpoints : int
    Number of points to show in legend entry.
**kwargs
    Keyword arguments forwarded to `.HandlerBase`.
NrM   )superr   
_numpoints_marker_pad)r   
marker_pad	numpointskwargs	__class__s       r   r   HandlerNpoints.__init__   s      	"6"#%r   c                 L    U R                   c  UR                  $ U R                   $ r   )rS   rV   r   r.   s     r   get_numpointsHandlerNpoints.get_numpoints   s"    ??"###??"r   c                     U R                  U5      nUS:  a7  U R                  U-  n[        R                  " U* U-   U* U-   U-
  U5      n	U	n
X4$ U* U* U-   /n	U* SU-  -   /n
X4$ )N         ?)r\   rT   nplinspace)r   r.   r2   r3   r4   r5   r6   rV   padxdataxdata_markers              r   	get_xdataHandlerNpoints.get_xdata   s    &&v.	q=""X-CKK	C!)	E 1C 7 )+E !L "" Y	E 12E%Ie34L""r   )rT   rS   )333333?N)
rG   rH   rI   rJ   rK   r   r\   rf   rL   __classcell__rX   s   @r   rO   rO      s    & ## #r   rO   c                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )HandlerNpointsYoffsets   zv
A legend handler that shows *numpoints* in the legend, and allows them to
be individually offset in the y-direction.
c                 6   > [         TU ]  " SSU0UD6  X l        g)z
Parameters
----------
numpoints : int
    Number of points to show in legend entry.
yoffsets : array of floats
    Length *numpoints* list of y offsets for each point in
    legend entry.
**kwargs
    Keyword arguments forwarded to `.HandlerNpoints`.
rV   NrM   )rR   r   	_yoffsets)r   rV   yoffsetsrW   rX   s       r   r   HandlerNpointsYoffsets.__init__   s     	7977!r   c                     U R                   c  XQR                  -  nU$ U[        R                  " U R                   5      -  nU$ r   ro   _scatteryoffsetsra   asarrayr   r.   r2   r3   r4   r5   r6   ydatas           r   	get_ydata HandlerNpointsYoffsets.get_ydata   s?    >>!444E  RZZ77Er   )ro   NN)	rG   rH   rI   rJ   rK   r   rx   rL   ri   rj   s   @r   rl   rl      s    
" r   rl   c                       \ rS rSrSrS rSrg)HandlerLine2DCompound   z
Original handler for `.Line2D` instances, that relies on combining
a line-only with a marker-only artist.  May be deprecated in the future.
c	                 *   U R                  XUXVU5      u  p[        R                  " XU-
  S-  5      n[        X5      nU R	                  XU5        UR                  S5        UR                  S5        [        XS [        U
5       5      nU R	                  XU5        UR                  S5        UR                  S:w  a.  UR                  5       UR                  -  nUR                  U5        Xl        UR                  U5        UR                  U5        X/$ )N   default Noner_   )rf   ra   	full_liker   r/   set_drawstyle
set_markerlenset_linestylemarkerscaleget_markersizeset_markersize
_legmarkerset_transform)r   r.   r$   r2   r3   r4   r5   r6   rD   rd   re   rw   leglinelegline_markernewszs                  r   r:   $HandlerLine2DCompound.create_artists   s    #nnVx-2HF Ux&71%<>&v6i(24FS5F.GHf=$$V,""113f6H6HHE))%0 ,e$$$U+((r   rM   NrG   rH   rI   rJ   rK   r:   rL   rM   r   r   r|   r|      s    
)r   r|   c                       \ rS rSrSrS rSrg)HandlerLine2Di  z
Handler for `.Line2D` instances.

See Also
--------
HandlerLine2DCompound : An earlier handler implementation, which used one
                        artist for the line and another for the marker(s).
c	                    U R                  XUXVU5      u  pS nU R                  U5      S:X  a!  [        R                  " U	S   U	S   S5      n	S/n[        R                  " XU-
  S-  5      n[        XUS9nU R                  XU5        UR                  S:w  a.  UR                  5       UR                  -  nUR                  U5        UR                  U5        U/$ )Nr_   r      r   )	markevery)rf   r\   ra   rb   r   r   r/   r   r   r   r   )r   r.   r$   r2   r3   r4   r5   r6   rD   rd   re   r   rw   r   r   s                  r   r:   HandlerLine2D.create_artists  s     #nnVx-2HF 	f%* KKa%)Q7EIUh%6!$;<;v6"**,v/A/AAE""5)e$yr   rM   Nr   rM   r   r   r   r     s    r   r   c                   <   ^  \ rS rSrSrSU 4S jjrS rS rSrU =r	$ )HandlerPatchi:  z!
Handler for `.Patch` instances.
c                 2   > [         TU ]  " S0 UD6  Xl        g)a  
Parameters
----------
patch_func : callable, optional
    The function that creates the legend key artist.
    *patch_func* should have the signature::

        def patch_func(legend=legend, orig_handle=orig_handle,
                       xdescent=xdescent, ydescent=ydescent,
                       width=width, height=height, fontsize=fontsize)

    Subsequently, the created artist will have its ``update_prop``
    method called and the appropriate transform will be applied.

**kwargs
    Keyword arguments forwarded to `.HandlerBase`.
NrM   )rR   r   _patch_func)r   
patch_funcrW   rX   s      r   r   HandlerPatch.__init__?  s    $ 	"6"%r   c           
      d    U R                   c  [        U* U* 4XVS9nU$ U R                  XX4XVUS9nU$ )Nxyr4   r5   )r.   r$   r2   r3   r4   r5   r6   )r   r   )	r   r.   r$   r2   r3   r4   r5   r6   ps	            r   _create_patchHandlerPatch._create_patchT  sV    #xi(3 %6A    *2',h ! PA r   c	           	      v    U R                  XX4XVU5      n	U R                  XU5        U	R                  U5        U	/$ r   )r   r/   r   
r   r.   r$   r2   r3   r4   r5   r6   rD   r   s
             r   r:   HandlerPatch.create_artists_  sA     v'5(L0	s
r   )r   r   )
rG   rH   rI   rJ   rK   r   r   r:   rL   ri   rj   s   @r   r   r   :  s    &*	 r   r   c                   >    \ rS rSrSr\S 5       r\S 5       rS rSr	g)HandlerStepPatchii  z9
Handler for `~.matplotlib.patches.StepPatch` instances.
c                 <    [        U* U* 4UX@R                  5       S9$ )N)r   r4   r5   color)r   get_facecolor)r$   r2   r3   r4   r5   s        r   r   HandlerStepPatch._create_patchn  s*    hY	2% &.G.G.IK 	Kr   c                     [        SU/US-  US-  /U R                  5       U R                  5       U R                  5       S9nUR	                  S5        UR                  S5        U$ )Nr   r   )r   	linestyle	linewidthr   r   )r   get_edgecolorget_linestyleget_linewidthr   r   )r$   r4   r5   r   s       r   _create_lineHandlerStepPatch._create_lines  sj     !UfQhq%9*88:#.#<#<#>#.#<#<#> 	i(2r   c	                     UR                  5       (       d  UR                  5       b&  U R                  X#XEU5      n	U R                  XU5        OU R	                  X%U5      n	U	R                  U5        U	/$ r   )get_fill	get_hatchr   r/   r   r   r   s
             r   r:   HandlerStepPatch.create_artists  sm     !!k&;&;&=&I"";(#)+AQV4!!+f=A	s
r   rM   N)
rG   rH   rI   rJ   rK   staticmethodr   r   r:   rL   rM   r   r   r   r   i  s6     K K  
r   r   c                   *    \ rS rSrSrS rS rS rSrg)HandlerLineCollectioni  z*
Handler for `.LineCollection` instances.
c                 L    U R                   c  UR                  $ U R                   $ r   rS   scatterpointsr[   s     r   r\   #HandlerLineCollection.get_numpoints  "    ??"'''??"r   c                     UR                  5       S   nUR                  S   nUR                  5       S   nUR                  U5        UR	                  U5        UR                  U5        g Nr   )get_linewidths_us_linestyles
get_colors	set_colorr   set_linewidth)r   r#   r$   lwdashesr   s         r   r!   *HandlerLineCollection._default_update_prop  sb    '')!,++A.&&(+&##F+##B'r   c	                     U R                  XUXVU5      u  p[        R                  " XU-
  S-  5      n[        X5      nU R	                  XU5        UR                  U5        U/$ )Nr   )rf   ra   r   r   r/   r   )r   r.   r$   r2   r3   r4   r5   r6   rD   rd   re   rw   r   s                r   r:   $HandlerLineCollection.create_artists  sg     #nnVx-2HFUh%6!$;<&v6e$yr   rM   N)	rG   rH   rI   rJ   rK   r\   r!   r:   rL   rM   r   r   r   r     s    #(r   r   c                   N   ^  \ rS rSrSrS
U 4S jjrS rS rS rS r	S r
S	rU =r$ )HandlerRegularPolyCollectioni  z'Handler for `.RegularPolyCollection`\s.c                 6   > [         TU ]  " SSU0UD6  X l        g )Nrp   rM   )rR   r   _sizes)r   rp   sizesrW   rX   s       r   r   %HandlerRegularPolyCollection.__init__  s    5(5f5r   c                 L    U R                   c  UR                  $ U R                   $ r   r   r[   s     r   r\   *HandlerRegularPolyCollection.get_numpoints  r   r   c                    U R                   c  UR                  5       n[        U5      (       d  S/n[        U5      UR                  S-  -  n	[        U5      UR                  S-  -  n
U R                  U5      nUS:  a  SX-   -  U	U
/S U nU$ X-
  nU[        R                  " SSU5      -  U
-   n U$ U R                   nU$ )Nr_   r      r`   r   )	r   	get_sizesr   maxr   minr\   ra   rb   )r   r.   r$   r2   r3   r4   r5   r6   handle_sizessize_maxsize_minrV   r   rngs                 r   r   &HandlerRegularPolyCollection.get_sizes  s    ;;&002L|$$ !s<(6+=+=+BBH<(6+=+=+BBH**62I1}x23X!##-I/   *bkk!Q	::XE  KKEr   c                     U R                  X5        UR                  UR                  SS95        UR                  S 5        UR	                  S 5        g )NF)root)r%   
set_figure
get_figurer+   r,   r-   s       r   r/   (HandlerRegularPolyCollection.update_prop  sH    -5  !2!2!2!>?""4(##D)r   c                 ^    [        U5      " UR                  5       UR                  5       UX4S9$ )N)rotationr   offsetsoffset_transform)typeget_numsidesget_rotationr   r$   r   r   r   s        r   create_collection.HandlerRegularPolyCollection.create_collection  s1    K $$& --/u
 	
r   c	           
         U R                  XUXVU5      u  pU R                  XUXVU5      nU R                  XX4XVU5      nU R                  X,[	        [        X5      5      US9nU R                  XU5        UR                  U5        U/$ N)r   r   )rf   rx   r   r   listzipr/   set_offset_transform)r   r.   r$   r2   r3   r4   r5   r6   rD   rd   re   rw   r   r   s                 r   r:   +HandlerRegularPolyCollection.create_artists  s     #nnVx-2HF v$h8 vH$h8 ""\12U # L 	0	u%s
r   )r   rz   )rG   rH   rI   rJ   rK   r   r\   r   r/   r   r:   rL   ri   rj   s   @r   r   r     s)    2
#**
 r   r   c                       \ rS rSrSrS rSrg)HandlerPathCollectioni  zDHandler for `.PathCollection`\s, which are used by `~.Axes.scatter`.c                 H    [        U5      " UR                  5       S   /UX4S9$ )Nr   )r   r   r   )r   	get_pathsr   s        r   r   'HandlerPathCollection.create_collection  s-    K ""$Q'(
 	
r   rM   NrG   rH   rI   rJ   rK   r   rL   rM   r   r   r   r     s
    O
r   r   c                       \ rS rSrSrS rSrg)HandlerCircleCollectioni  z"Handler for `.CircleCollection`\s.c                 "    [        U5      " X#US9$ r   )r   r   s        r   r   )HandlerCircleCollection.create_collection  s    K 5EG 	Gr   rM   Nr   rM   r   r   r   r     s    -Gr   r   c                   @   ^  \ rS rSrSr  SU 4S jjrS rS rSrU =r	$ )HandlerErrorbari	  zHandler for Errorbars.c                 B   > Xl         X l        [        TU ]  " SX4S.UD6  g )N)rU   rV   rM   )
_xerr_size
_yerr_sizerR   r   )r   	xerr_size	yerr_sizerU   rV   rW   rX   s         r   r   HandlerErrorbar.__init__  s$     $#NJNvNr   c                 h    U R                   U-  nU R                  c  UnXx4$ U R                  U-  nXx4$ r   r  r  )	r   r.   r2   r3   r4   r5   r6   r  r  s	            r   get_err_sizeHandlerErrorbar.get_err_size  sC    OOh.	??"!I ## (2I##r   c	                 ^   Uu  pnU R                  XUXVU5      u  p[        R                  " XU-
  S-  5      n[        X5      n[        R                  " U5      n[        R                  " US [        U5       5      nU R                  XUXVU5      u  nn[        UU5      nU	c#  UR                  S5        UR                  S5        OU R                  XU5        UR                  S5        UR                  S5        U R                  UX5        UR                  S5        UR                  S:w  a.  UR                  5       UR                  -  nUR                  U5        / n/ nUR                  (       a  [!        UU5       VVs/ s H  u  nnUU-
  U4UU-   U44PM     nnn["        R$                  " U5      nU R                  UUS   U5        UR'                  U5        U
(       a  [        UU-
  U5      n[        UU-   U5      nU R                  UU
S   U5        U R                  UU
S   U5        UR                  S5        UR                  S5        UR'                  U5        UR'                  U5        UR(                  (       a  [!        UU5       VVs/ s H  u  nnUUU-
  4UUU-   44PM     nnn["        R$                  " U5      nU R                  UUS   U5        UR'                  U5        U
(       a  [        UUU-
  5      n[        UUU-   5      nU R                  UU
S   U5        U R                  UU
S   U5        UR                  S	5        UR                  S	5        UR'                  U5        UR'                  U5        / UQUQUPUPnU H  nUR+                  U5        M     U$ s  snnf s  snnf )
Nr   Fr   noner   r_   r   |_)rf   ra   r   r   ru   r   r	  set_visibler/   r   r   r   r   r   r   has_xerrr   mcollLineCollectionappendhas_yerrr   )r   r.   r$   r2   r3   r4   r5   r6   rD   	plotlinescaplinesbarlinecolsrd   re   rw   r   ydata_markerr  r  r   r   handle_barlinecolshandle_caplinesxyvertscollcapline_leftcapline_rightr>   artists                                  r   r:   HandlerErrorbar.create_artists  s    ,7(	["nnVx-2HF Uh%6!$;<&zz,/zz%(:\):";<#00816 J	9  l; &&&u-W8!!),v&^Y?((0!!Q&&557&:L:LL--e4!$\<!@B!@A 9}a(1y=!*<=!@  B''.DT;q>6:%%d+%lY&>M &|i'? N  x{FC  VD'',((-&&|4&&}5!$\<!@B!@A !i-(1a)m*<=!@  B''.DT;q>6:%%d+%lL94LM &|\I5M N  x{FC  VD'',((-&&|4&&}5

"1
3:
<J
 F  ' QB$Bs   =N#N)r  )r`   Nrh   N)
rG   rH   rI   rJ   rK   r   r	  r:   rL   ri   rj   s   @r   r   r   	  s#     04+/O	$R Rr   r   c                   F   ^  \ rS rSrSr  SU 4S jjrS rS rS rSr	U =r
$ )	HandlerStemit  z.
Handler for plots produced by `~.Axes.stem`.
c                 8   > [         TU ]  " SXUS.UD6  X0l        g)a  
Parameters
----------
marker_pad : float, default: 0.3
    Padding between points in legend entry.
numpoints : int, optional
    Number of points to show in legend entry.
bottom : float, optional

yoffsets : array of floats, optional
    Length *numpoints* list of y offsets for each point in
    legend entry.
**kwargs
    Keyword arguments forwarded to `.HandlerNpointsYoffsets`.
)rU   rV   rp   NrM   )rR   r   _bottom)r   rU   rV   bottomrp   rW   rX   s         r   r   HandlerStem.__init__y  s)    " 	 	6J"*	6.4	6r   c                     U R                   c  USUR                  -  S-   -  nU$ U[        R                  " U R                   5      -  nU$ )Nr`   rs   rv   s           r   rx   HandlerStem.get_ydata  sK    >>!cF$;$;;cABE  RZZ77Er   c	           	      j   Uu  pn[        U
[        R                  5      nU R                  XUXVU5      u  pU R	                  XUXVU5      nU R
                  c  SnOU R
                  n[        XS [        U5       5      nU R                  UX5        [        X5       VVs/ s H  u  nn[        UU/UU/5      PM     nnnU(       aC  [        R                  " X R                  S9   U H  nU R                  UX5        M     S S S 5        O)[        UU
5       H  u  nnU R                  UUU5        M     [        [        R                  " U5      [        R                  " U5      /UU/5      nU R                  UX5        / UQUPUPnU H  nUR!                  U5        M     U$ s  snnf ! , (       d  f       N= f)NrF   )r   )
isinstancer  r  rf   rx   r&  r   r   r/   r   r   _setattr_cm_copy_collection_propsra   r   r   r   )r   r.   r$   r2   r3   r4   r5   r6   rD   
markerline	stemlinesbaselineusing_linecollrd   re   rw   r'  leg_markerliner  r  leg_stemlineslinelmmleg_baseliner>   r!  s                              r   r:   HandlerStem.create_artists  s    +6'
x $Iu/C/CD"nnVx-2HF v$h8 <<F\\F4FS5F.GH< &)%=?%=TQ  A4%= 	 ?  "",G,GI)D$$T9= *I I ]I6A  Q/ 7 rvve}bffUm<%v.0x8@M@<@@F  ' -?I Is   F"F$$
F2c                     UR                  UR                  5       S   5        UR                  UR                  5       S   5        g)z\
Copy properties from the `.LineCollection` *orig_handle* to the
`.Line2D` *legend_handle*.
r   N)r   	get_colorr   r   r"   s      r   r.  "HandlerStem._copy_collection_props  s<    
 	 5 5 7 :;##K$=$=$?$BCr   )r&  )rh   NNN)rG   rH   rI   rJ   rK   r   rx   r:   r.  rL   ri   rj   s   @r   r$  r$  t  s,     26'+*.`D Dr   r$  c                   6   ^  \ rS rSrSrSU 4S jjrS rSrU =r$ )HandlerTuplei  z
Handler for Tuple.
c                 >   > Xl         X l        [        TU ]  " S0 UD6  g)a=  
Parameters
----------
ndivide : int or None, default: 1
    The number of sections to divide the legend area into.  If None,
    use the length of the input tuple.
pad : float, default: :rc:`legend.borderpad`
    Padding in units of fraction of font size.
**kwargs
    Keyword arguments forwarded to `.HandlerBase`.
NrM   )_ndivide_padrR   r   )r   ndividerc   rW   rX   s       r   r   HandlerTuple.__init__  s      	"6"r   c	                    UR                  5       n	U R                  c  [        U5      n
OU R                  n
U R                  c  UR                  U-  nOU R                  U-  nU
S:  a  X[U
S-
  -  -
  U
-  n[        X5U-   [        R                  " U
5      -  -
  5      n/ nU HC  nUR                  X5      nUR                  X[        U5      XEXgU5      nUR                  U5        ME     U$ )Nr_   )get_legend_handler_mapr@  r   rA  	borderpadr   ra   arangeget_legend_handlerr:   r	   extend)r   r.   r$   r2   r3   r4   r5   r6   rD   handler_maprB  rc   	xds_cyclea_listhandle1handler_a_lists                    r   r:   HandlerTuple.create_artists  s     335== +&GmmG99""X-C))h&CQ;GaK00G;E(ckRYYw5G%GGH	"G//EG,,Y&EKG MM'" # r   )r@  rA  )r_   N)	rG   rH   rI   rJ   rK   r   r:   rL   ri   rj   s   @r   r>  r>    s    #  r   r>  c                   $    \ rS rSrSrS rS rSrg)HandlerPolyCollectioni  zU
Handler for `.PolyCollection` used in `~.Axes.fill_between` and
`~.Axes.stackplot`.
c                 R   S nS nU" UR                  5       5      Ul        U" UR                  5       5      Ul        UR                  Ul        UR
                  Ul        UR                  5       Ul        UR                  5       Ul	        UR                  Ul
        UR                  U" UR                  5       5      5        UR                  U" UR                  5       5      5        UR                  U" UR!                  5       5      5        UR#                  UR%                  5       5        g )Nc                 @    U R                   S:X  a  g[        U S   5      $ )Nr   )r   r   r   r   )sizetuple)colorss    r   first_color7HandlerPolyCollection._update_prop.<locals>.first_color
  s     {{a###r   c                 .    [        U 5      (       a  U S   $ g r   )r   )
prop_arrays    r   	get_first5HandlerPolyCollection._update_prop.<locals>.get_first  s    :!!}$r   )r   
_facecolorr   
_edgecolor_original_facecolor_original_edgecolorr   _fillr   _hatch_hatch_colorr   r   r   get_linestylesr   get_transformsr   r   )r   r#   r$   rX  r\  s        r   r%   "HandlerPolyCollection._update_prop	  s    	$
	 $/{/H/H/J#K #.{/H/H/J#K ,7,K,K),7,K,K))224*446%0%=%="##Ik.H.H.J$KL##Ik.H.H.J$KL##Ik.H.H.J$KL  !7!7!9:r   c	                 j    [        U* U* 4XVS9n	U R                  XU5        U	R                  U5        U	/$ )Nr   )r   r/   r   r   s
             r   r:   $HandlerPolyCollection.create_artists&  s?     8)hY/!20	s
r   rM   N)rG   rH   rI   rJ   rK   r%   r:   rL   rM   r   r   rR  rR    s    ;:r   rR  )rK   	itertoolsr   numpyra   
matplotlibr   matplotlib.linesr   matplotlib.patchesr   matplotlib.collectionscollectionsr  r   r   rO   rl   r|   r   r   r   r   r   r   r   r   r$  r>  rR  rM   r   r   <module>rq     s   :    # ( &%u; u;p'#[ '#T^ <")N ")J$N $N,; ,^"{ "JM @F#9 FR
8 
G: Ghm hVXD( XDv2; 2j)K )r   