ó
º¶Y]c           @` sÉ  d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l	 m
 Z
 d d l Z d d l m Z d d l m Z d d l j Z d d l j Z d „  Z d	 e f d
 „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ  d e f d „  ƒ  YZ! d e f d „  ƒ  YZ" d e f d „  ƒ  YZ# d e f d  „  ƒ  YZ$ d! e f d" „  ƒ  YZ% d S(#   uÁ  
This module defines default legend handlers.

It is strongly encouraged to have read the :doc:`legend guide
</tutorials/intermediate/legend_guide>` before 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 a
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 needs to
be scaled according to the fontsize (note that the size is in pixel,
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):

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   zip(   t   cycle(   t   Line2D(   t	   Rectanglec         C` s   |  j  | j ƒ  d ƒ d  S(   Ni    (   t   update_fromt   get_children(   t   tgtt   src(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   update_from_first_child)   s    t   HandlerBasec           B` sV   e  Z d  Z d d d	 d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 RS(
   u   
    A Base class for default legend handlers.

    The derived classes are meant to override *create_artists* method, which
    has a 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.

    g        c         C` s    | | |  _  |  _ | |  _ d  S(   N(   t   _xpadt   _ypadt   _update_prop_func(   t   selft   xpadt   ypadt   update_func(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   __init__=   s    c         C` s6   |  j  d  k r" |  j | | ƒ n |  j  | | ƒ d  S(   N(   R   t   Nonet   _default_update_prop(   R   t   legend_handlet   orig_handle(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   _update_propA   s    c         C` s   | j  | ƒ d  S(   N(   R   (   R   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   G   s    c         C` s;   |  j  | | ƒ | j | ƒ | j d  ƒ | j d  ƒ d  S(   N(   R   t   _set_artist_propst   set_clip_boxR   t   set_clip_path(   R   R   R   t   legend(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   update_propJ   s    c         C` sT   | |  j  | } | |  j | } | |  j  | } | |  j | } | | | | f S(   N(   R   R   (   R   R   R   t   xdescentt   ydescentt   widtht   heightt   fontsize(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   adjust_drawing_areaR   s
    c      	   C` s‰   |  j  | | | j | j | j | j | ƒ \ } } } } |  j | | | | | | | | j ƒ  ƒ }	 x |	 D] }
 | j |
 ƒ qj W|	 d S(   uU  
        Return the artist that this HandlerBase generates for the given
        original artist/handle.

        Parameters
        ----------
        legend : :class:`matplotlib.legend.Legend` instance
            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 : float or int
            The fontsize in pixels. The artists being created should
            be scaled according to the given fontsize.
        handlebox : :class:`matplotlib.offsetbox.OffsetBox` instance
            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.

        i    (   R%   R    R!   R"   R#   t   create_artistst   get_transformt
   add_artist(   R   R   R   R$   t	   handleboxR    R!   R"   R#   t   artistst   a(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   legend_artist[   s    c	   	      C` s   t  d ƒ ‚ d  S(   Nu   Derived must override(   t   NotImplementedError(	   R   R   R   R    R!   R"   R#   R$   t   trans(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   €   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R%   R,   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   -   s   						%t   HandlerNpointsc           B` s/   e  Z d  Z d d d „ Z d „  Z d „  Z RS(   uM   
    A legend handler that shows *numpoints* points in the legend entry.
    g333333Ó?c         K` s&   t  j |  |  | |  _ | |  _ d S(   u*  
        Parameters
        ----------
        marker_pad : float
            Padding between points in legend entry.

        numpoints : int
            Number of points to show in legend entry.

        Notes
        -----
        Any other keyword arguments are given to `HandlerBase`.
        N(   R   R   t
   _numpointst   _marker_pad(   R   t
   marker_padt	   numpointst   kw(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   Š   s    	c         C` s!   |  j  d  k r | j S|  j  Sd  S(   N(   R3   R   R6   (   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   get_numpoints   s    c         C` s‹   |  j  | ƒ } | d k rT |  j | } t j | | | | | | ƒ }	 |	 }
 n- t j | | | d ƒ }	 | d | g }
 |	 |
 f S(   Ni   i   g      à?(   R8   R4   t   npt   linspace(   R   R   R    R!   R"   R#   R$   R6   t   padt   xdatat   xdata_marker(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt	   get_xdata£   s    		N(   R/   R0   R1   R   R   R8   R>   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR2   †   s   	t   HandlerNpointsYoffsetsc           B` s&   e  Z d  Z d d d „ Z d „  Z RS(   u‚   
    A legend handler that shows *numpoints* in the legend, and allows them to
    be individually offest in the y-direction.
    c         K` s#   t  j |  d | | | |  _ d S(   u^  
        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.

        Notes
        -----
        Any other keyword arguments are given to `HandlerNpoints`.
        R6   N(   R2   R   t	   _yoffsets(   R   R6   t   yoffsetsR7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   ·   s    c         C` s9   |  j  d  k r | | j } n | t j |  j  ƒ } | S(   N(   R@   R   t   _scatteryoffsetsR9   t   asarray(   R   R   R    R!   R"   R#   R$   t   ydata(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt	   get_ydataÉ   s    N(   R/   R0   R1   R   R   RE   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR?   ²   s   t   HandlerLine2Dc           B` s&   e  Z d  Z d d d „ Z d „  Z RS(   u*   
    Handler for `.Line2D` instances.
    g333333Ó?c         K` s    t  j |  d | d | | d S(   u-  
        Parameters
        ----------
        marker_pad : float
            Padding between points in legend entry.

        numpoints : int
            Number of points to show in legend entry.

        Notes
        -----
        Any other keyword arguments are given to `HandlerNpoints`.
        R5   R6   N(   R2   R   (   R   R5   R6   R7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   Ö   s    c	         C` s  |  j  | | | | | | ƒ \ }	 }
 | | d t j |	 j t ƒ } t |	 | ƒ } |  j | | | ƒ | j d ƒ | j d ƒ t |
 | t	 |
 ƒ  ƒ } |  j | | | ƒ | j
 d ƒ | j d k rì | j ƒ  | j } | j | ƒ n  | | _ | j | ƒ | j | ƒ | | g S(   Ng       @u   defaultu    u   Nonei   (   R>   R9   t   onest   shapet   floatR   R   t   set_drawstylet
   set_markert   lent   set_linestylet   markerscalet   get_markersizet   set_markersizet
   _legmarkert   set_transform(   R   R   R   R    R!   R"   R#   R$   R.   R<   R=   RD   t   leglinet   legline_markert   newsz(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   ç   s"    !	N(   R/   R0   R1   R   R   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRF   Ò   s   t   HandlerPatchc           B` s,   e  Z d  Z d d „ Z d „  Z d „  Z RS(   u)   
    Handler for `.Patch` instances.
    c         K` s   t  j |  |  | |  _ d S(   u•  
        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.

        Notes
        -----
        Any other keyword arguments are given to `HandlerBase`.
        N(   R   R   t   _patch_func(   R   t
   patch_funcR7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   
  s    c   	      C` so   |  j  d  k r5 t d | | f d | d | ƒ } n6 |  j  d | d | d | d | d | d | d | ƒ } | S(	   Nt   xyR"   R#   R   R   R    R!   R$   (   RW   R   R   (	   R   R   R   R    R!   R"   R#   R$   t   p(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   _create_patch   s    c	   
      C` sH   |  j  | | | | | | | ƒ }	 |  j |	 | | ƒ |	 j | ƒ |	 g S(   N(   R[   R   RR   (
   R   R   R   R    R!   R"   R#   R$   R.   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   +  s
    N(   R/   R0   R1   R   R   R[   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRV     s   	t   HandlerLineCollectionc           B` s)   e  Z d  Z d „  Z d „  Z d „  Z RS(   u2   
    Handler for `.LineCollection` instances.
    c         C` s!   |  j  d  k r | j S|  j  Sd  S(   N(   R3   R   t   scatterpoints(   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR8   8  s    c         C` sX   | j  ƒ  d } | j d } | j ƒ  d } | j | ƒ | j | ƒ | j | ƒ d  S(   Ni    (   t   get_linewidthst   _us_linestylest
   get_colorst	   set_colorRM   t   set_linewidth(   R   R   R   t   lwt   dashest   color(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   >  s    c	         C` s{   |  j  | | | | | | ƒ \ }	 }
 | | d t j |	 j t ƒ } t |	 | ƒ } |  j | | | ƒ | j | ƒ | g S(   Ng       @(   R>   R9   RG   RH   RI   R   R   RR   (   R   R   R   R    R!   R"   R#   R$   R.   R<   R=   RD   RS   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   F  s    !(   R/   R0   R1   R8   R   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR\   4  s   		t   HandlerRegularPolyCollectionc           B` sJ   e  Z d  Z d d d „ Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   u0   
    Handler for `.RegularPolyCollections`.
    c         K` s#   t  j |  d | | | |  _ d  S(   NRA   (   R?   R   t   _sizes(   R   RA   t   sizesR7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   X  s    c         C` s!   |  j  d  k r | j S|  j  Sd  S(   N(   R3   R   R]   (   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR8   ]  s    c         C` sÑ   |  j  d  k rÄ | j ƒ  } t | ƒ s3 d g } n  t | ƒ | j d }	 t | ƒ | j d }
 |  j | ƒ } | d k  rš d |	 |
 |	 |
 g |  } qÍ |	 |
 } | t j	 d d | ƒ |
 } n	 |  j  } | S(   Ni   i   i   g      à?i    (
   Rg   R   t	   get_sizesRL   t   maxRN   t   minR8   R9   R:   (   R   R   R   R    R!   R"   R#   R$   t   handle_sizest   size_maxt   size_minR6   Rh   t   rng(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRi   c  s    
 	c         C` s>   |  j  | | ƒ | j | j ƒ | j d  ƒ | j d  ƒ d  S(   N(   R   t
   set_figuret   figureR   R   R   (   R   R   R   R   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   x  s    c      
   C` s:   t  | ƒ | j ƒ  d | j ƒ  d | d | d | ƒ} | S(   Nt   rotationRh   t   offsetst   transOffset(   t   typet   get_numsidest   get_rotation(   R   R   Rh   Rs   Rt   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   create_collection  s    	c	         C` s³   |  j  | | | | | | ƒ \ }	 }
 |  j | | | | | | ƒ } |  j | | | | | | | ƒ } |  j | | d t t |
 | ƒ ƒ d | ƒ} |  j | | | ƒ | | _ | g S(   NRs   Rt   (   R>   RE   Ri   Rx   t   listR   R   t   _transOffset(   R   R   R   R    R!   R"   R#   R$   R.   R<   R=   RD   Rh   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   Š  s    		N(
   R/   R0   R1   R   R   R8   Ri   R   Rx   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRf   T  s   						t   HandlerPathCollectionc           B` s   e  Z d  Z d „  Z RS(   uM   
    Handler for `.PathCollections`, which are used by `~.Axes.scatter`.
    c         C` s5   t  | ƒ | j ƒ  d g d | d | d | ƒ} | S(   Ni    Rh   Rs   Rt   (   Ru   t	   get_paths(   R   R   Rh   Rs   Rt   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRx   £  s
    	(   R/   R0   R1   Rx   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR{   Ÿ  s   t   HandlerCircleCollectionc           B` s   e  Z d  Z d „  Z RS(   u+   
    Handler for `.CircleCollections`.
    c         C` s"   t  | ƒ | d | d | ƒ} | S(   NRs   Rt   (   Ru   (   R   R   Rh   Rs   Rt   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRx   °  s    	(   R/   R0   R1   Rx   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR}   ¬  s   t   HandlerErrorbarc           B` s5   e  Z d  Z d d d d d „ Z d „  Z d „  Z RS(   u    
    Handler for Errorbars.
    g      à?g333333Ó?c         K` s2   | |  _  | |  _ t j |  d | d | | d  S(   NR5   R6   (   t
   _xerr_sizet
   _yerr_sizeRF   R   (   R   t	   xerr_sizet	   yerr_sizeR5   R6   R7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   ¼  s    		c   	      C` s<   |  j  | } |  j d  k r% | } n |  j | } | | f S(   N(   R   R€   R   (	   R   R   R    R!   R"   R#   R$   R   R‚   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   get_err_sizeÅ  s
    	c	         C` sò  | \ }	 }
 } |  j  | | | | | | ƒ \ } } | | d t j | j t ƒ } t | | ƒ } t j | ƒ } t j | t | ƒ  ƒ } |  j | | | | | | ƒ \ } } t | | ƒ } |	 d  k rç | j
 t ƒ | j
 t ƒ n |  j | |	 | ƒ | j d ƒ | j d ƒ |  j | |	 | ƒ | j d ƒ | j d k rf| j ƒ  | j } | j | ƒ n  g  } g  } | j r„g  t | | ƒ D], \ } } | | | f | | | f f ^ q‹} t j | ƒ } |  j | | d | ƒ | j | ƒ |
 r„t | | | ƒ } t | | | ƒ } |  j | |
 d | ƒ |  j | |
 d | ƒ | j d ƒ | j d ƒ | j | ƒ | j | ƒ q„n  | j r–g  t | | ƒ D], \ } } | | | f | | | f f ^ q} t j | ƒ } |  j | | d | ƒ | j | ƒ |
 r–t | | | ƒ } t | | | ƒ } |  j | |
 d | ƒ |  j | |
 d | ƒ | j d ƒ | j d ƒ | j | ƒ | j | ƒ q–n  g  } | j | ƒ | j | ƒ | j | ƒ | j | ƒ x | D] } | j | ƒ q×W| S(   Ng       @u   defaultu   Nonei   i    u   |u   _(   R>   R9   RG   RH   RI   R   RC   RL   Rƒ   R   t   set_visiblet   FalseR   RJ   RK   RM   RN   RO   RP   t   has_xerrR   t   mcollt   LineCollectiont   appendt   has_yerrt   extendRR   (   R   R   R   R    R!   R"   R#   R$   R.   t	   plotlinest   caplinest   barlinecolsR<   R=   RD   RS   t   ydata_markerR   R‚   RT   RU   t   handle_barlinecolst   handle_caplinest   xt   yt   vertst   collt   capline_leftt   capline_rightR*   t   artist(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   Ð  sz    !	?	?N(   R/   R0   R1   R   R   Rƒ   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR~   ¸  s
   	t   HandlerStemc           B` s5   e  Z d  Z d d d d d „ Z d „  Z d „  Z RS(   u6   
    Handler for plots produced by `~.Axes.stem`.
    g333333Ó?c      	   K` s/   t  j |  d | d | d | | | |  _ d S(   uü  
        Parameters
        ----------
        marker_pad : float
            Padding between points in legend entry. Default is 0.3.

        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.

        Notes
        -----
        Any other keyword arguments are given to `HandlerNpointsYoffsets`.
        R5   R6   RA   N(   R?   R   t   _bottom(   R   R5   R6   t   bottomRA   R7   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   -  s
    c         C` sA   |  j  d  k r' | d | j d } n | t j |  j  ƒ } | S(   Ng      à?(   R@   R   RB   R9   RC   (   R   R   R    R!   R"   R#   R$   RD   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyRE   I  s    c	         C` s¤  | \ }	 }
 } |  j  | | | | | | ƒ \ } } |  j | | | | | | ƒ } |  j d  k ri d } n	 |  j } t | | t | ƒ  ƒ } |  j | |	 | ƒ g  } xE t | | ƒ D]4 \ } } t | | g | | g ƒ } | j | ƒ q´ Wx0 t | |
 ƒ D] \ } } |  j | | | ƒ qü Wt t	 j
 | ƒ t	 j | ƒ g | | g ƒ } |  j | | | ƒ | g } | j | ƒ | j | ƒ x | D] } | j | ƒ q‰W| S(   Ng        (   R>   RE   Rš   R   R   RL   R   R   R‰   R9   Rk   Rj   R‹   RR   (   R   R   R   R    R!   R"   R#   R$   R.   t
   markerlinet	   stemlinest   baselineR<   R=   RD   R›   t   leg_markerlinet   leg_stemlinest   thisxt   thisyt   lt   lmt   mt   leg_baselineR*   R˜   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   Q  s2    			N(   R/   R0   R1   R   R   RE   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR™   )  s
   	t   HandlerTuplec           B` s&   e  Z d  Z d d d „ Z d „  Z RS(   u¯  
    Handler for Tuple.

    Additional kwargs are passed through to `HandlerBase`.

    Parameters
    ----------
    ndivide : int, optional
        The number of sections to divide the legend area into. If None,
        use the length of the input tuple. Default is 1.


    pad : float, optional
        If None, fall back to ``legend.borderpad`` as the default.
        In units of fraction of font size. Default is None.
    i   c         K` s&   | |  _  | |  _ t j |  |  d  S(   N(   t   _ndividet   _padR   R   (   R   t   ndivideR;   t   kwargs(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR     s    		c	      
   C` s	  | j  ƒ  }	 |  j d  k r* t | ƒ }
 n	 |  j }
 |  j d  k rR | j | } n |  j | } |
 d k r„ | | |
 d |
 } n  t | | | t j |
 ƒ ƒ } g  } xW | D]O } | j	 |	 | ƒ } | j
 | | t | ƒ | | | | | ƒ } | j | ƒ q² W| S(   Ni   (   t   get_legend_handler_mapR¨   R   RL   R©   t	   borderpadR   R9   t   aranget   get_legend_handlerR&   t   nextR‹   (   R   R   R   R    R!   R"   R#   R$   R.   t   handler_mapRª   R;   t	   xds_cyclet   a_listt   handle1t   handlert   _a_list(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   “  s$    	!N(   R/   R0   R1   R   R   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR§   |  s   t   HandlerPolyCollectionc           B` s    e  Z d  Z d „  Z d „  Z RS(   u]   
    Handler for `.PolyCollection` used in `~.Axes.fill_between` and `~.Axes.stackplot`.
    c         C` s  d „  } d „  } t  | d | j ƒ  ƒ } | j | | ƒ ƒ t  | d | j ƒ  ƒ } | j | | ƒ ƒ | j | j ƒ  ƒ | j | j ƒ  ƒ | j	 | | j
 ƒ  ƒ ƒ | j | | j ƒ  ƒ ƒ | j | | j ƒ  ƒ ƒ | j | j ƒ  ƒ | j | j ƒ  ƒ d  S(   Nc         S` s;   |  d  k r d  St j |  ƒ }  t |  ƒ r3 |  d Sd Sd  S(   Ni    u   none(   R   t   mcolorst   to_rgba_arrayRL   (   t   colors(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   first_color¸  s    c         S` s   t  |  ƒ r |  d Sd  Sd  S(   Ni    (   RL   R   (   t
   prop_array(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt	   get_firstÁ  s    u   _original_edgecoloru   _original_facecolor(   t   getattrt   get_edgecolort   set_edgecolort   get_facecolort   set_facecolort   set_fillt   get_fillt	   set_hatcht	   get_hatchRb   R^   RM   t   get_linestylesRR   t   get_transformsRp   t
   get_figuret	   set_alphat	   get_alpha(   R   R   R   R»   R½   t	   edgecolort	   facecolor(    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR   ·  s    					c	   
      C` sJ   t  d | | f d | d | ƒ }	 |  j |	 | | ƒ |	 j | ƒ |	 g S(   NRY   R"   R#   (   R   R   RR   (
   R   R   R   R    R!   R"   R#   R$   R.   RZ   (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR&   Ô  s
    (   R/   R0   R1   R   R&   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyR·   ³  s   	(&   R1   t
   __future__R    R   R   R   t   sixt	   six.movesR   t	   itertoolsR   t   numpyR9   t   matplotlib.linesR   t   matplotlib.patchesR   t   matplotlib.collectionst   collectionsR‡   t   matplotlib.colorsRº   R¸   R   t   objectR   R2   R?   RF   RV   R\   Rf   R{   R}   R~   R™   R§   R·   (    (    (    s8   lib/python2.7/site-packages/matplotlib/legend_handler.pyt   <module>   s.   "	Y, 4. KqS7