o
    môj°t  ã                   @   sB  d Z ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ dd„ ZG d	d
„ d
ƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd„ deƒZG dd „ d eƒZG d!d"„ d"eƒZG d#d$„ d$eƒZG d%d&„ d&eƒZdS )'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                 C   s,   t t| ¡ ƒd ƒ}|d ur|  |¡ d S d S ©N)ÚnextÚiterÚget_childrenÚupdate_from)ÚtgtÚsrcZfirst_child© r   úl/var/www/html/academy/tools/voices/clone/cosy-venv/lib/python3.10/site-packages/matplotlib/legend_handler.pyÚupdate_from_first_child(   s   ÿr   c                   @   sJ   e Zd ZdZddd„Zdd„ Zdd	„ Zd
d„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚHandlerBasea  
    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                 C   s   ||| _ | _|| _dS )ak  
        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)ÚselfZxpadZypadÚupdate_funcr   r   r   Ú__init__>   s   
zHandlerBase.__init__c                 C   s*   | j d u r|  ||¡ d S |   ||¡ d S r   )r   Ú_default_update_prop©r   Úlegend_handleÚorig_handler   r   r   Ú_update_propM   s   
zHandlerBase._update_propc                 C   s   |  |¡ d S r   )r   r   r   r   r   r   S   s   z HandlerBase._default_update_propc                 C   s.   |   ||¡ | |¡ | d ¡ | d ¡ d S r   )r   Ú_set_artist_propsÚset_clip_boxÚset_clip_path©r   r   r   Úlegendr   r   r   Úupdate_propV   s   

zHandlerBase.update_propc                 C   sD   || j |  }|| j|  }|| j |  }|| j|  }||||fS r   )r   r   )r   r"   r   ÚxdescentÚydescentÚwidthÚheightÚfontsizer   r   r   Úadjust_drawing_area^   s
   zHandlerBase.adjust_drawing_areac                 C   s^   |   |||j|j|j|j|¡\}}}}|  |||||||| ¡ ¡}	|	D ]}
| |
¡ q#|	d 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   )r)   r$   r%   r&   r'   Úcreate_artistsÚget_transformÚ
add_artist)r   r"   r   r(   Ú	handleboxr$   r%   r&   r'   ÚartistsÚar   r   r   Úlegend_artistg   s   üþzHandlerBase.legend_artistc	           	      C   s   t dƒ‚)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   r$   r%   r&   r'   r(   Útransr   r   r   r*   Œ   s   zHandlerBase.create_artists)r   r   N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r#   r)   r0   r*   r   r   r   r   r   .   s    
	%r   c                       s2   e Zd ZdZd
‡ fdd„	Zdd„ Zdd	„ Z‡  ZS )ÚHandlerNpointszM
    A legend handler that shows *numpoints* points in the legend entry.
    ç333333Ó?Nc                    s"   t ƒ jdi |¤Ž || _|| _dS )a  
        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`.
        Nr   )Úsuperr   Ú
_numpointsÚ_marker_pad)r   Ú
marker_padÚ	numpointsÚkwargs©Ú	__class__r   r   r   «   s   
zHandlerNpoints.__init__c                 C   ó   | j d u r|jS | j S r   )r:   r=   ©r   r"   r   r   r   Úget_numpoints»   ó   
zHandlerNpoints.get_numpointsc                 C   sn   |   |¡}|dkr#| j| }t | | | | | |¡}	|	}
|	|
fS | | | g}	| d|  g}
|	|
fS )Né   ç      à?)rC   r;   ÚnpÚlinspace)r   r"   r$   r%   r&   r'   r(   r=   ÚpadÚxdataÚxdata_markerr   r   r   Ú	get_xdataÁ   s   

þþzHandlerNpoints.get_xdata)r8   N)r3   r4   r5   r6   r   rC   rL   Ú__classcell__r   r   r?   r   r7   ¦   s
    r7   c                       s*   e Zd ZdZd‡ fdd„	Zdd„ Z‡  ZS )ÚHandlerNpointsYoffsetsz‚
    A legend handler that shows *numpoints* in the legend, and allows them to
    be individually offset in the y-direction.
    Nc                    s    t ƒ jdd|i|¤Ž || _dS )aL  
        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`.
        r=   Nr   )r9   r   Ú	_yoffsets)r   r=   Úyoffsetsr>   r?   r   r   r   Ö   s   
zHandlerNpointsYoffsets.__init__c                 C   s,   | j d u r||j }|S |t | j ¡ }|S r   ©rO   Ú_scatteryoffsetsrG   Úasarray©r   r"   r$   r%   r&   r'   r(   Úydatar   r   r   Ú	get_ydataå   s
   

þz HandlerNpointsYoffsets.get_ydata©NN)r3   r4   r5   r6   r   rV   rM   r   r   r?   r   rN   Ð   s    rN   c                   @   ó   e Zd ZdZdd„ ZdS )ÚHandlerLine2DCompoundz™
    Original handler for `.Line2D` instances, that relies on combining
    a line-only with a marker-only artist.  May be deprecated in the future.
    c	                 C   sÊ   |   ||||||¡\}	}
t |	|| d ¡}t|	|ƒ}|  |||¡ | d¡ | d¡ t|
|d t|
ƒ… ƒ}|  |||¡ | d¡ |j	dkrT| 
¡ |j	 }| |¡ ||_| |¡ | |¡ ||gS )Né   ÚdefaultÚ ÚNonerE   )rL   rG   Ú	full_liker   r#   Úset_drawstyleÚ
set_markerÚlenÚset_linestyleÚmarkerscaleÚget_markersizeÚset_markersizeZ
_legmarkerÚset_transform)r   r"   r   r$   r%   r&   r'   r(   r2   rJ   rK   rU   ÚleglineÚlegline_markerÚnewszr   r   r   r*   ô   s$   
ÿ







z$HandlerLine2DCompound.create_artistsN©r3   r4   r5   r6   r*   r   r   r   r   rY   î   s    rY   c                   @   rX   )ÚHandlerLine2Dzâ
    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	                 C   s¨   |   ||||||¡\}	}
d }|  |¡dkr#t |	d |	d d¡}	dg}t |	|| d ¡}t|	||d�}|  |||¡ |jdkrL| ¡ |j }| 	|¡ | 
|¡ |gS )NrE   r   éÿÿÿÿé   rZ   )Ú	markevery)rL   rC   rG   rH   r^   r   r#   rc   rd   re   rf   )r   r"   r   r$   r%   r&   r'   r(   r2   rJ   rK   rn   rU   rg   ri   r   r   r   r*     s   
ÿ


zHandlerLine2D.create_artistsNrj   r   r   r   r   rk     s    	rk   c                       s2   e Zd ZdZd	‡ fdd„	Zdd„ Zdd„ Z‡  ZS )
ÚHandlerPatchz)
    Handler for `.Patch` instances.
    Nc                    s   t ƒ jdi |¤Ž || _dS )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`.
        Nr   )r9   r   Ú_patch_func)r   Z
patch_funcr>   r?   r   r   r   ?  s   
zHandlerPatch.__init__c           	   	   C   s@   | j d u rt| | f||d�}|S | j |||||||d�}|S )N©Úxyr&   r'   )r"   r   r$   r%   r&   r'   r(   )rp   r   )	r   r"   r   r$   r%   r&   r'   r(   Úpr   r   r   Ú_create_patchT  s   
ÿýþzHandlerPatch._create_patchc	           
   	   C   s4   |   |||||||¡}	|  |	||¡ |	 |¡ |	gS r   )rt   r#   rf   ©
r   r"   r   r$   r%   r&   r'   r(   r2   rs   r   r   r   r*   _  s   
ÿ
zHandlerPatch.create_artistsr   )r3   r4   r5   r6   r   rt   r*   rM   r   r   r?   r   ro   :  s
    ro   c                   @   s0   e Zd ZdZedd„ ƒZedd„ ƒZdd„ ZdS )	ÚHandlerStepPatchzA
    Handler for `~.matplotlib.patches.StepPatch` instances.
    c                 C   s   t | | f|||  ¡ d�S )N)rr   r&   r'   Úcolor)r   Úget_facecolor)r   r$   r%   r&   r'   r   r   r   rt   n  s   ÿzHandlerStepPatch._create_patchc                 C   sF   t d|g|d |d g|  ¡ |  ¡ |  ¡ d�}| d¡ | d¡ |S )Nr   rZ   )rw   Ú	linestyleÚ	linewidthr[   r\   )r   Úget_edgecolorÚget_linestyleÚget_linewidthr_   r`   )r   r&   r'   rg   r   r   r   Ú_create_lines  s   ý

zHandlerStepPatch._create_linec	           
      C   sT   |  ¡ s
| ¡ d ur|  |||||¡}	|  |	||¡ n|  |||¡}	|	 |¡ |	gS r   )Úget_fillÚ	get_hatchrt   r#   r~   rf   ru   r   r   r   r*   �  s   ÿ
zHandlerStepPatch.create_artistsN)r3   r4   r5   r6   Ústaticmethodrt   r~   r*   r   r   r   r   rv   i  s    

rv   c                   @   s(   e Zd ZdZdd„ Zdd„ Zdd„ ZdS )	ÚHandlerLineCollectionz2
    Handler for `.LineCollection` instances.
    c                 C   rA   r   ©r:   ÚscatterpointsrB   r   r   r   rC   ’  rD   z#HandlerLineCollection.get_numpointsc                 C   sD   |  ¡ d }|jd }| ¡ d }| |¡ | |¡ | |¡ d S ©Nr   )Úget_linewidthsÚ_us_linestylesÚ
get_colorsÚ	set_colorrb   Úset_linewidth)r   r   r   ÚlwÚdashesrw   r   r   r   r   ˜  s   


z*HandlerLineCollection._default_update_propc	                 C   sT   |   ||||||¡\}	}
t |	|| d ¡}t|	|ƒ}|  |||¡ | |¡ |gS )NrZ   )rL   rG   r^   r   r#   rf   )r   r"   r   r$   r%   r&   r'   r(   r2   rJ   rK   rU   rg   r   r   r   r*      s   
ÿ

z$HandlerLineCollection.create_artistsN)r3   r4   r5   r6   rC   r   r*   r   r   r   r   r‚   Ž  s
    r‚   c                       sJ   e Zd ZdZd‡ fdd„	Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	‡  Z
S )ÚHandlerRegularPolyCollectionz'Handler for `.RegularPolyCollection`\s.Nc                    s    t ƒ jdd|i|¤Ž || _d S )NrP   r   )r9   r   Ú_sizes)r   rP   Úsizesr>   r?   r   r   r   ±  s   
z%HandlerRegularPolyCollection.__init__c                 C   rA   r   rƒ   rB   r   r   r   rC   ¶  rD   z*HandlerRegularPolyCollection.get_numpointsc                 C   s    | j d u rK| ¡ }t|ƒsdg}t|ƒ|jd  }	t|ƒ|jd  }
|  |¡}|dk r:d|	|
  |	|
gd |… }|S |	|
 }|t dd|¡ |
 }|S | j }|S )NrE   rZ   é   rF   r   )	rŽ   Ú	get_sizesra   Úmaxrc   ÚminrC   rG   rH   )r   r"   r   r$   r%   r&   r'   r(   Zhandle_sizesZsize_maxZsize_minr=   r�   Úrngr   r   r   r‘   ¼  s&   

ÿÿûþz&HandlerRegularPolyCollection.get_sizesc                 C   s6   |   ||¡ | |jdd�¡ | d ¡ | d ¡ d S )NF)Úroot)r   Ú
set_figureÚ
get_figurer   r    r!   r   r   r   r#   Ñ  s   
z(HandlerRegularPolyCollection.update_propc                 C   s   t |ƒ| ¡ | ¡ |||d�S )N)Úrotationr�   ÚoffsetsÚoffset_transform)ÚtypeÚget_numsidesÚget_rotation©r   r   r�   r™   rš   r   r   r   Úcreate_collectionÚ  s
   ýz.HandlerRegularPolyCollection.create_collectionc	              	   C   s|   |   ||||||¡\}	}
|  ||||||¡}|  |||||||¡}| j||tt|
|ƒƒ|d�}|  |||¡ | |¡ |gS ©N)r™   rš   )rL   rV   r‘   rŸ   ÚlistÚzipr#   Úset_offset_transform)r   r"   r   r$   r%   r&   r'   r(   r2   rJ   rK   rU   r�   rs   r   r   r   r*   á  s    
ÿ
ÿÿþ
z+HandlerRegularPolyCollection.create_artistsrW   )r3   r4   r5   r6   r   rC   r‘   r#   rŸ   r*   rM   r   r   r?   r   r�   ®  s    	r�   c                   @   rX   )ÚHandlerPathCollectionzDHandler for `.PathCollection`\s, which are used by `~.Axes.scatter`.c                 C   s   t |ƒ| ¡ d g|||d�S )Nr   )r�   r™   rš   )r›   Ú	get_pathsrž   r   r   r   rŸ   ú  s   þz'HandlerPathCollection.create_collectionN©r3   r4   r5   r6   rŸ   r   r   r   r   r¤   ÷  ó    r¤   c                   @   rX   )ÚHandlerCircleCollectionz"Handler for `.CircleCollection`\s.c                 C   s   t |ƒ|||d�S r    )r›   rž   r   r   r   rŸ     s   ÿz)HandlerCircleCollection.create_collectionNr¦   r   r   r   r   r¨     r§   r¨   c                       s6   e Zd ZdZ		d‡ fdd„	Zdd„ Zd	d
„ Z‡  ZS )ÚHandlerErrorbarzHandler for Errorbars.rF   Nr8   c                    s(   || _ || _tƒ jd||dœ|¤Ž d S )N)r<   r=   r   )Ú
_xerr_sizeÚ
_yerr_sizer9   r   )r   Ú	xerr_sizeÚ	yerr_sizer<   r=   r>   r?   r   r   r     s   zHandlerErrorbar.__init__c           	      C   s2   | j | }| jd u r|}||fS | j| }||fS r   )rª   r«   )	r   r"   r$   r%   r&   r'   r(   r¬   r­   r   r   r   Úget_err_size  s   


þzHandlerErrorbar.get_err_sizec	                    s–  |\}	}
}|   ||||||¡\}}t ||| d ¡}t||ƒ}t |¡}t |d t|ƒ… ¡}|  ||||||¡\‰ ‰t||ƒ}|	d u rP| d¡ | d¡ n.|  ||	|¡ | 	d¡ | 
d¡ |  ||	|¡ | d¡ |jdkr~| ¡ |j }| |¡ g }g }|jrÚ‡ fdd„t||ƒD ƒ}t |¡}|  ||d	 |¡ | |¡ |
rÚt|ˆ  |ƒ}t|ˆ  |ƒ}|  ||
d	 |¡ |  ||
d	 |¡ | 
d
¡ | 
d
¡ | |¡ | |¡ |j�r4‡fdd„t||ƒD ƒ}t |¡}|  ||d	 |¡ | |¡ |
�r4t||ˆ ƒ}t||ˆ ƒ}|  ||
d	 |¡ |  ||
d	 |¡ | 
d¡ | 
d¡ | |¡ | |¡ g |¢|¢|‘|‘}|D ]}| |¡ �q@|S )NrZ   Fr[   Únoner]   rE   c                    s(   g | ]\}}|ˆ  |f|ˆ  |ff‘qS r   r   ©Ú.0ÚxÚy)r¬   r   r   Ú
<listcomp>I  ó    ÿz2HandlerErrorbar.create_artists.<locals>.<listcomp>r   ú|c                    s(   g | ]\}}||ˆ  f||ˆ  ff‘qS r   r   r°   )r­   r   r   r´   [  rµ   Ú_)rL   rG   r^   r   rS   ra   r®   Úset_visibler#   r_   r`   rb   rc   rd   re   Úhas_xerrr¢   ÚmcollÚLineCollectionÚappendÚhas_yerrrf   )r   r"   r   r$   r%   r&   r'   r(   r2   Z	plotlinesÚcaplinesÚbarlinecolsrJ   rK   rU   rg   Zydata_markerrh   ri   Zhandle_barlinecolsZhandle_caplinesÚvertsÚcollZcapline_leftZcapline_rightr.   Úartistr   )r¬   r­   r   r*     sŠ   

ÿ


ÿ







ÿ






ÿ





ÿÿÿÿzHandlerErrorbar.create_artists)rF   Nr8   N)r3   r4   r5   r6   r   r®   r*   rM   r   r   r?   r   r©   	  s    ÿr©   c                       s>   e Zd ZdZ		d‡ fdd„	Zdd„ Zdd	„ Zd
d„ Z‡  ZS )ÚHandlerStemz6
    Handler for plots produced by `~.Axes.stem`.
    r8   Nc                    s$   t ƒ jd|||dœ|¤Ž || _dS )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`.
        )r<   r=   rP   Nr   )r9   r   Ú_bottom)r   r<   r=   ÚbottomrP   r>   r?   r   r   r   y  s   ÿÿ
zHandlerStem.__init__c                 C   s4   | j d u r|d|j d  }|S |t | j ¡ }|S )NrF   rQ   rT   r   r   r   rV   Ž  s
   
þzHandlerStem.get_ydatac	                    sX  |\}	}
}t |
tjƒ}|  ||||||¡\}}|  ||||||¡}| jd u r)d‰ n| j‰ t||d t|ƒ… ƒ}|  ||	|¡ ‡ fdd„t	||ƒD ƒ}|rqt
j| | jd�� |D ]	}|  ||
|¡ qWW d   ƒ n1 skw   Y  nt	||
ƒD ]\}}|  |||¡ qvtt |¡t |¡gˆ ˆ gƒ}|  |||¡ g |¢|‘|‘}|D ]}| |¡ q¢|S )Nr   c                    s"   g | ]\}}t ||gˆ |gƒ‘qS r   r   r°   ©rÅ   r   r   r´   ®  s    ÿz.HandlerStem.create_artists.<locals>.<listcomp>)r   )Ú
isinstancerº   r»   rL   rV   rÄ   r   ra   r#   r¢   r   Ú_setattr_cmÚ_copy_collection_propsrG   r“   r’   rf   )r   r"   r   r$   r%   r&   r'   r(   r2   Ú
markerlineÚ	stemlinesÚbaselineZusing_linecollrJ   rK   rU   Zleg_markerlineZleg_stemlinesÚlineÚlmÚmZleg_baseliner.   rÂ   r   rÆ   r   r*   –  sF   

ÿ
ÿ

ÿÿÿþ€ÿzHandlerStem.create_artistsc                 C   s(   |  | ¡ d ¡ | | ¡ d ¡ dS )zt
        Copy properties from the `.LineCollection` *orig_handle* to the
        `.Line2D` *legend_handle*.
        r   N)r‰   Ú	get_colorrb   r|   r   r   r   r   rÉ   Æ  s   z"HandlerStem._copy_collection_props)r8   NNN)	r3   r4   r5   r6   r   rV   r*   rÉ   rM   r   r   r?   r   rÃ   t  s    ÿ0rÃ   c                       s*   e Zd ZdZd‡ fdd„	Zdd„ Z‡  ZS )	ÚHandlerTuplez
    Handler for Tuple.
    rE   Nc                    s"   || _ || _tƒ jdi |¤Ž dS )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`.
        Nr   )Ú_ndivideÚ_padr9   r   )r   ÚndividerI   r>   r?   r   r   r   Ô  s   zHandlerTuple.__init__c	                 C   s¼   |  ¡ }	| jd u rt|ƒ}
n| j}
| jd u r|j| }n| j| }|
dkr/|||
d   |
 }t||| t |
¡  ƒ}g }|D ]}| |	|¡}| 	||t
|ƒ|||||¡}| |¡ q@|S )NrE   )Úget_legend_handler_maprÒ   ra   rÓ   Ú	borderpadr   rG   ÚarangeÚget_legend_handlerr*   r   Úextend)r   r"   r   r$   r%   r&   r'   r(   r2   Úhandler_maprÔ   rI   Z	xds_cycleÚa_listZhandle1ÚhandlerZ_a_listr   r   r   r*   ä  s&   



þzHandlerTuple.create_artists)rE   N)r3   r4   r5   r6   r   r*   rM   r   r   r?   r   rÑ   Ï  s    rÑ   c                   @   s    e Zd ZdZdd„ Zdd„ ZdS )ÚHandlerPolyCollectionza
    Handler for `.PolyCollection` used in `~.Axes.fill_between` and
    `~.Axes.stackplot`.
    c                 C   s’   dd„ }dd„ }||  ¡ ƒ|_|| ¡ ƒ|_|j|_|j|_| ¡ |_| ¡ |_	|j
|_
| || ¡ ƒ¡ | || ¡ ƒ¡ | || ¡ ƒ¡ d S )Nc                 S   s   | j dkrdS t| d ƒS )Nr   )r   r   r   r   )ÚsizeÚtuple)Úcolorsr   r   r   Úfirst_color
  s   
z7HandlerPolyCollection._update_prop.<locals>.first_colorc                 S   s   t | ƒr| d S d S r…   )ra   )Z
prop_arrayr   r   r   Ú	get_first  s   z5HandlerPolyCollection._update_prop.<locals>.get_first)rx   Ú
_facecolorr{   Ú
_edgecolorÚ_original_facecolorÚ_original_edgecolorr   Ú_fillr€   Ú_hatchÚ_hatch_colorrŠ   r†   rb   Úget_linestylesrf   Úget_transforms)r   r   r   rá   râ   r   r   r   r   	  s   

z"HandlerPolyCollection._update_propc	           
      C   s4   t | | f||d�}	|  |	||¡ |	 |¡ |	gS )Nrq   )r   r#   rf   ru   r   r   r   r*   %  s   ÿ
z$HandlerPolyCollection.create_artistsN)r3   r4   r5   r6   r   r*   r   r   r   r   rÝ     s    rÝ   )r6   Ú	itertoolsr   ÚnumpyrG   Ú
matplotlibr   Úmatplotlib.linesr   Úmatplotlib.patchesr   Úmatplotlib.collectionsÚcollectionsrº   r   r   r7   rN   rY   rk   ro   rv   r‚   r�   r¤   r¨   r©   rÃ   rÑ   rÝ   r   r   r   r   Ú<module>   s.    x*%'/% I
k[5