B
    ]t\/a                 @   s  d Z ddlZddlZddlmZmZmZm	Z	m
ZmZ ddlmZmZmZmZmZ ddlmZ ddlmZ ddlmZ d	d
 Zdd Zdd ZG dd dejZdAddZG dd de	j Z!dBddZ"dCddZ#dDddZ$dEddZ%dFddZ&G d d! d!eZ'dGd"d#Z(G d$d% d%eZ)G d&d' d'e)Z*d(d) Z+dHd*d+Z,dId,d-Z-G d.d/ d/eZ.G d0d1 d1eZ/dJd3d4Z0G d5d6 d6eZ1dKd7d8Z2d9d: Z3d;d< Z4d=d> Z5d?d@ Z6dS )Lzx
Module containing 3D artist code and functions to convert 2D
artists into 3D versions which can be added to an Axes3D.
    N)artistcbookcolorslinestextpath)
CollectionLineCollectionPolyCollectionPatchCollectionPathCollection)	Normalize)Patch   )proj3dc             C   s    | d d } | dkr| d } | S )z?Return the given angle normalized to -180 < *a* <= 180 degrees.ih      )ar   r   9lib/python3.7/site-packages/mpl_toolkits/mplot3d/art3d.py
norm_angle   s    r   c             C   s    | d d } | dkr| d } | S )z=Return the given angle normalized to -90 < *a* <= 90 degrees.r   Z   r   )r   r   r   r   norm_text_angle    s    r   c             C   sn   | dkrt dS | dkr$t dS | dkr6t dS | dkrHt dS t| rbt| d	krb| S td
dS )a   
    Return a direction vector.

    Parameters
    ----------
    zdir : {'x', 'y', 'z', None, 3-tuple}
        The direction. Possible values are:
        - 'x': equivalent to (1, 0, 0)
        - 'y': euqivalent to (0, 1, 0)
        - 'z': equivalent to (0, 0, 1)
        - *None*: euqivalent to (0, 0, 0)
        - an iterable (x, y, z) is returned unchanged.

    Returns
    -------
    x, y, z : array-like
        The direction vector. This is either a numpy.array or *zdir* itself if
        *zdir* is already a length-3 iterable.

    x)r   r   r   y)r   r   r   z)r   r   r   N)r   r   r      z2'x', 'y', 'z', None or vector of length 3 expected)nparrayr   iterablelen
ValueError)zdirr   r   r   get_dir_vector(   s    



r"   c               @   s:   e Zd ZdZdddZdddZejd	d
 Zdd Z	dS )Text3Da  
    Text object with 3D position and direction.

    Parameters
    ----------
    x, y, z
        The position of the text.
    text : str
        The text string to display.
    zdir : {'x', 'y', 'z', None, 3-tuple}
        The direction of the text. See `.get_dir_vector` for a description of
        the values.

    Other Parameters
    ----------------
    **kwargs
         All other parameters are passed on to `~matplotlib.text.Text`.
   r    r   c             K   s&   t jj| |||f| | || d S )N)mtextText__init__set_3d_properties)selfr   r   r   r   r!   kwargsr   r   r   r'   _   s    zText3D.__init__c             C   s2   |   \}}t|||f| _t|| _d| _d S )NT)Zget_positionr   r   _position3dr"   _dir_vecstale)r)   r   r!   r   r   r   r   r   r(   c   s    
zText3D.set_3d_propertiesc             C   s   t | j| j| j g|j}|d d |d d  }|d d |d d  }|dkrb|dkrbd}ntt||}| |d d |d d f | 	t
| tj| | d| _d S )Nr   r   g        F)r   proj_trans_pointsr+   r,   MmathZdegreesZatan2Zset_positionZset_rotationr   r%   r&   drawr-   )r)   rendererZprojZdxZdyZangler   r   r   r1   i   s    zText3D.drawc             C   s   d S )Nr   )r)   r2   r   r   r   get_tightbboxy   s    zText3D.get_tightbboxN)r   r   r   r$   r   )r   r   )
__name__
__module____qualname____doc__r'   r(   r   allow_rasterizationr1   r3   r   r   r   r   r#   K   s
   

r#   r   c             C   s   t | _| || dS )z"Convert a Text to a Text3D object.N)r#   	__class__r(   )objr   r!   r   r   r   text_2d_to_3d   s    r;   c               @   s0   e Zd ZdZdd ZdddZejdd	 Zd
S )Line3Dz
    3D line object.
    c             O   s(   t jj| g g f|| |||f| _dS )zU
        Keyword arguments are passed onto :func:`~matplotlib.lines.Line2D`.
        N)r   Line2Dr'   _verts3d)r)   xsyszsargsr*   r   r   r   r'      s    zLine3D.__init__r   r   c             C   sV   |   }|  }ytj|t|d}W n tk
r:   Y nX t||||| _d| _d S )N)Z
fill_valueT)	Z	get_xdataZ	get_ydatar   Z	full_likefloat	TypeErrorjuggle_axesr>   r-   )r)   rA   r!   r?   r@   r   r   r   r(      s    zLine3D.set_3d_propertiesc             C   sH   | j \}}}t||||j\}}}| || tj| | d| _d S )NF)	r>   r   Zproj_transformr/   set_datar   r=   r1   r-   )r)   r2   Zxs3dZys3dZzs3dr?   r@   rA   r   r   r   r1      s
    zLine3D.drawN)r   r   )	r4   r5   r6   r7   r'   r(   r   r8   r1   r   r   r   r   r<      s   
r<   c             C   s   t | _| || dS )zConvert a 2D line to 3D.N)r<   r9   r(   )linerA   r!   r   r   r   line_2d_to_3d   s    rH   c                sH   t |t| }| jddd}dd t||D } fdd|D }|S )zConvert a path to a 3D segment.F)simplifycurvesc             S   s"   g | ]\\\}}}}|||fqS r   r   ).0r   r   coder   r   r   r   
<listcomp>   s    z&path_to_3d_segment.<locals>.<listcomp>c                s    g | ]\}}}t ||| qS r   )rE   )rK   r   r   r   )r!   r   r   rM      s    )r   broadcast_tor   iter_segmentszip)r   rA   r!   pathsegssegseg3dr   )r!   r   path_to_3d_segment   s
    rT   c                s,   t |t| } fddt| |D }|S )z6Convert paths from a collection object to 3D segments.c                s   g | ]\}}t || qS r   )rT   )rK   r   pathz)r!   r   r   rM      s   z(paths_to_3d_segments.<locals>.<listcomp>)r   rN   r   rP   )pathsrA   r!   segsr   )r!   r   paths_to_3d_segments   s    
rX   c                sz   t |t| }g }g }| jddd}x8t||D ]*\\\}}}}	||||	f || q2W  fdd|D }
|
|fS )z/Convert a path to a 3D segment with path codes.F)rI   rJ   c                s    g | ]\}}}t ||| qS r   )rE   )rK   r   r   r   )r!   r   r   rM      s    z1path_to_3d_segment_with_codes.<locals>.<listcomp>)r   rN   r   rO   rP   append)r   rA   r!   rR   codesrQ   r   r   rL   r   rS   r   )r!   r   path_to_3d_segment_with_codes   s    r[   c       	      C   s\   t |t| }g }g }x:t| |D ],\}}t|||\}}|| || q$W ||fS )zP
    Convert paths from a collection object to 3D segments with path codes.
    )r   rN   r   rP   r[   rY   )	rV   rA   r!   segmentsZ
codes_listr   rU   rW   rZ   r   r   r   paths_to_3d_segments_with_codes   s    
r]   c               @   s8   e Zd ZdZdd Zdd Zdd Zejdd	d
Z	dS )Line3DCollectionz#
    A collection of 3D lines.
    c             C   s   || _ d| _dS )z&Set the position to use for z-sorting.TN)
_sort_zposr-   )r)   valr   r   r   set_sort_zpos   s    zLine3DCollection.set_sort_zposc             C   s   t || _t| g  dS )z"
        Set 3D segments.
        N)r   Z
asanyarray_segments3dr	   set_segments)r)   r\   r   r   r   rc      s    zLine3DCollection.set_segmentsc                sX    fdd| j D }dd |D }t| | d}x |D ]\}}}t|t|}q8W |S )zB
        Project the points according to renderer matrix.
        c                s   g | ]}t | jqS r   )r   r.   r/   )rK   points)r2   r   r   rM      s    z5Line3DCollection.do_3d_projection.<locals>.<listcomp>c             S   s    g | ]\}}}t ||gqS r   )r   column_stack)rK   r?   r@   rA   r   r   r   rM      s    g    eA)rb   r	   rc   min)r)   r2   Zxyslistsegments_2dZminzr?   r@   rA   r   )r2   r   do_3d_projection   s    

z!Line3DCollection.do_3d_projectionFc             C   s   |r|  | t| | d S )N)rh   r	   r1   )r)   r2   Zprojectr   r   r   r1      s    
zLine3DCollection.drawN)F)
r4   r5   r6   r7   ra   rc   rh   r   r8   r1   r   r   r   r   r^      s   r^   c             C   s$   t |  ||}t| _| | dS )z6Convert a LineCollection to a Line3DCollection object.N)rX   	get_pathsr^   r9   rc   )colrA   r!   
segments3dr   r   r   line_collection_2d_to_3d  s    rl   c               @   sB   e Zd ZdZdddddZddd	Zd
d Zdd Zdd ZdS )Patch3Dz
    3D patch object.
    r   r   )rA   r!   c            O   s"   t j| f|| | || d S )N)r   r'   r(   )r)   rA   r!   rB   r*   r   r   r   r'     s    zPatch3D.__init__r   c                s:   t |t|} fddt||D | _t| | _d S )Nc                s"   g | ]\\}}}t ||| qS r   )rE   )rK   r   r   r   )r!   r   r   rM     s   z-Patch3D.set_3d_properties.<locals>.<listcomp>)r   rN   r   rP   
_segment3dr   get_facecolor_facecolor3d)r)   vertsrA   r!   r   )r!   r   r(     s    
zPatch3D.set_3d_propertiesc             C   s   | j S )N)_path2d)r)   r   r   r   get_path  s    zPatch3D.get_pathc             C   s   | j S )N)_facecolor2d)r)   r   r   r   ro     s    zPatch3D.get_facecolorc       
      C   sT   | j }t| \}}}t||||j\}}}}	tt||g| _	| j
| _t|S )N)rn   rP   r   proj_transform_clipr/   mpathPathr   re   rr   rp   rt   rf   )
r)   r2   sr?   r@   rA   vxsvysvzsvisr   r   r   rh   "  s    zPatch3D.do_3d_projectionN)r   r   )	r4   r5   r6   r7   r'   r(   rs   ro   rh   r   r   r   r   rm     s   
rm   c               @   s2   e Zd ZdZdddddZddd	Zd
d ZdS )PathPatch3Dz
    3D PathPatch object.
    r   r   )rA   r!   c            K   s    t j| f| | ||| d S )N)r   r'   r(   )r)   r   rA   r!   r*   r   r   r   r'   1  s    zPathPatch3D.__init__r   c             C   s    t j| |j||d |j| _d S )N)rA   r!   )rm   r(   ZverticesrZ   _code3d)r)   r   rA   r!   r   r   r   r(   5  s    zPathPatch3D.set_3d_propertiesc       
      C   sX   | j }t| \}}}t||||j\}}}}	tt||g| j	| _
| j| _t|S )N)rn   rP   r   ru   r/   rv   rw   r   re   r~   rr   rp   rt   rf   )
r)   r2   rx   r?   r@   rA   ry   rz   r{   r|   r   r   r   rh   9  s    zPathPatch3D.do_3d_projectionN)r   r   )r4   r5   r6   r7   r'   r(   rh   r   r   r   r   r}   ,  s   
r}   c             C   s2   |   }|  }||}t|r*|d S g S dS )z2Return a list of vertices for the path of a patch.r   N)get_patch_transformrs   Zto_polygonsr   )patchtransr   Zpolygonsr   r   r   get_patch_vertsC  s    
r   c             C   s    t | }t| _| ||| dS )z$Convert a Patch to a Patch3D object.N)r   rm   r9   r(   )r   r   r!   rq   r   r   r   patch_2d_to_3dN  s    r   c             C   s2   |   }|  }||}t| _| ||| dS )z,Convert a PathPatch to a PathPatch3D object.N)rs   r   Ztransform_pathr}   r9   r(   )Z	pathpatchr   r!   r   r   rv   r   r   r   pathpatch_2d_to_3dU  s
    
r   c                   sB   e Zd ZdZdddd fdd
Zdd	 Zd
d Zdd Z  ZS )Patch3DCollectionz%
    A collection of 3D patches.
    r   r   T)rA   r!   
depthshadec               s$   || _ t j|| | || dS )a  
        Create a collection of flat 3D patches with its normal vector
        pointed in *zdir* direction, and located at *zs* on the *zdir*
        axis. 'zs' can be a scalar or an array-like of the same length as
        the number of patches in the collection.

        Constructor arguments are the same as for
        :class:`~matplotlib.collections.PatchCollection`. In addition,
        keywords *zs=0* and *zdir='z'* are available.

        Also, the keyword argument "depthshade" is available to
        indicate whether or not to shade the patches in order to
        give the appearance of depth (default is *True*).
        This is typically desired in scatter plots.
        N)_depthshadesuperr'   r(   )r)   rA   r!   r   rB   r*   )r9   r   r   r'   d  s    zPatch3DCollection.__init__c             C   s   || _ d| _dS )z&Set the position to use for z-sorting.TN)r_   r-   )r)   r`   r   r   r   ra   x  s    zPatch3DCollection.set_sort_zposc             C   sd   |    |  }t|dkr(|j\}}ng }g }t||t||| _|  | _	| 
 | _d| _d S )Nr   T)update_scalarmappableget_offsetsr   TrE   r   
atleast_1d
_offsets3dro   rp   get_edgecolor_edgecolor3dr-   )r)   rA   r!   offsetsr?   r@   r   r   r   r(   }  s    

z#Patch3DCollection.set_3d_propertiesc             C   s   | j \}}}t||||j\}}}}| jr8t| j|n| j}	t|	| j	}	| 
|	 | jrht| j|n| j}
t|
| j	}
| |
 t| t||g |jdkrt|S tjS d S )Nr   )r   r   ru   r/   r   zalpharp   mcolorsto_rgba_array_alphaset_facecolorsr   set_edgecolorsr   set_offsetsr   re   sizerf   nan)r)   r2   r?   r@   rA   ry   rz   r{   r|   fcsecsr   r   r   rh     s    


z"Patch3DCollection.do_3d_projection)	r4   r5   r6   r7   r'   ra   r(   rh   __classcell__r   r   )r9   r   r   _  s
   r   c                   sB   e Zd ZdZdddd fdd
Zdd	 Zd
d Zdd Z  ZS )Path3DCollectionz#
    A collection of 3D paths.
    r   r   T)rA   r!   r   c               s$   || _ t j|| | || dS )a  
        Create a collection of flat 3D paths with its normal vector
        pointed in *zdir* direction, and located at *zs* on the *zdir*
        axis. 'zs' can be a scalar or an array-like of the same length as
        the number of paths in the collection.

        Constructor arguments are the same as for
        :class:`~matplotlib.collections.PathCollection`. In addition,
        keywords *zs=0* and *zdir='z'* are available.

        Also, the keyword argument "depthshade" is available to
        indicate whether or not to shade the patches in order to
        give the appearance of depth (default is *True*).
        This is typically desired in scatter plots.
        N)r   r   r'   r(   )r)   rA   r!   r   rB   r*   )r9   r   r   r'     s    zPath3DCollection.__init__c             C   s   || _ d| _dS )z&Set the position to use for z-sorting.TN)r_   r-   )r)   r`   r   r   r   ra     s    zPath3DCollection.set_sort_zposc             C   sd   |    |  }t|dkr(|j\}}ng }g }t||t||| _|  | _	| 
 | _d| _d S )Nr   T)r   r   r   r   rE   r   r   r   ro   rp   r   r   r-   )r)   rA   r!   r   r?   r@   r   r   r   r(     s    

z"Path3DCollection.set_3d_propertiesc             C   s   | j \}}}t||||j\}}}}| jr8t| j|n| j}	t|	| j	}	| 
|	 | jrht| j|n| j}
t|
| j	}
| |
 t| t||g |jdkrt|S tjS d S )Nr   )r   r   ru   r/   r   r   rp   r   r   r   r   r   r   r   r   r   re   r   rf   r   )r)   r2   r?   r@   rA   ry   rz   r{   r|   r   r   r   r   r   rh     s    


z!Path3DCollection.do_3d_projection)	r4   r5   r6   r7   r'   ra   r(   rh   r   r   r   )r9   r   r     s
   r   Tc             C   s8   t | trt| _nt | tr"t| _|| _| || dS )a  
    Convert a :class:`~matplotlib.collections.PatchCollection` into a
    :class:`Patch3DCollection` object
    (or a :class:`~matplotlib.collections.PathCollection` into a
    :class:`Path3DCollection` object).

    Parameters
    ----------
    za
        The location or locations to place the patches in the collection along
        the *zdir* axis. Default: 0.
    zdir
        The axis in which to place the patches. Default: "z".
    depthshade
        Whether to shade the patches to give a sense of depth. Default: *True*.

    N)
isinstancer   r   r9   r   r   r   r(   )rj   rA   r!   r   r   r   r   patch_collection_2d_to_3d  s    

r   c                   s   e Zd ZdZdd fdd
ZejejejdZ	dd Z
d	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d Zdd Zdd Z  ZS ) Poly3DCollectionz&
    A collection of 3D polygons.
    T)zsortc               s(   t  j|f|| | | d| _dS )a  
        Create a Poly3DCollection.

        *verts* should contain 3D coordinates.

        Keyword arguments:
        zsort, see set_zsort for options.

        Note that this class does a bit of magic with the _facecolors
        and _edgecolors properties.
        N)r   r'   	set_zsort_codes3d)r)   rq   r   rB   r*   )r9   r   r   r'     s    
zPoly3DCollection.__init__)averagerf   maxc             C   sP   |dkrd}|dk	r0|| j kr*| j | }q4dS nd}|| _d| _|| _d| _dS )au  
        Sets the calculation method for the z-order.

        Parameters
        ----------
        zsort : bool or {'average', 'min', 'max'}
            For 'average', 'min', 'max' the z-order is determined by applying
            the function to the z-coordinates of the vertices in the viewer's
            coordinate system. *True* is equivalent to 'average'.
        Tr   FN)_zsort_functions_zsortr_   
_zsortfuncr-   )r)   r   Z	zsortfuncr   r   r   r     s    
zPoly3DCollection.set_zsortc             C   s   d}d}g }g }x4|D ],}| | |t| }|||f |}qW t|r^t| \}}}	ng g g   }}}	tt|}
t|||	|
g| _|| _dS )zOptimize points for projection.r   N)	extendr   rY   rP   r   onesr   _vec_segis)r)   rk   sieiZsegisrd   pr?   r@   rA   r   r   r   r   
get_vector4  s    

zPoly3DCollection.get_vectorc             C   s"   |  | t| g d || _dS )zSet 3D vertices.FN)r   r
   	set_verts_closed)r)   rq   closedr   r   r   r   J  s    
zPoly3DCollection.set_vertsc             C   s   | j |dd || _dS )z!Sets 3D vertices with path codes.F)r   N)r   r   )r)   rq   rZ   r   r   r   set_verts_and_codesQ  s    z$Poly3DCollection.set_verts_and_codesc             C   sF   |    d | _| d t| | _t| | _t| | _	d| _
d S )NT)r   r_   r   r
   ro   _facecolors3dr   _edgecolors3dZ	get_alphaZ_alpha3dr-   )r)   r   r   r   r(   Y  s    
z"Poly3DCollection.set_3d_propertiesc             C   s   || _ d| _dS )z&Set the position to use for z-sorting.TN)r_   r-   )r)   r`   r   r   r   ra   d  s    zPoly3DCollection.set_sort_zposc       
         s   j dk	r    j _t j|j\fdd jD } j} j	}t
|t
|krv|jt
|dd}t
|t
|krt
|dkr|}n|jt
|dd} jrt fddtt|||D dd	 d
d}ntddd |D } jdk	r" fdd|D }t || nt | j dd |D  _t
 j	t
|krhdd |D  _n j	 _ jdk	rtdgdg jgdgg}t||j}	|	d d S jdkrtS tjS dS )z<
        Perform the 3D projection for this object.
        Nc                s2   g | ]*\}} || || || fqS r   r   )rK   r   r   )txstystzsr   r   rM   s  s   z5Poly3DCollection.do_3d_projection.<locals>.<listcomp>r   )Zaxisc             3   s<   | ]4\}\\}}}}}  |t||g|||fV  qd S )N)r   r   re   )rK   idxr?   r@   rA   fcec)r)   r   r   	<genexpr>  s   z4Poly3DCollection.do_3d_projection.<locals>.<genexpr>c             S   s   | d S )Nr   r   )r   r   r   r   <lambda>  s    z3Poly3DCollection.do_3d_projection.<locals>.<lambda>T)keyreverseZwhoopsc             S   s   g | ]\}}}}}|qS r   r   )rK   r   rx   r   r   r   r   r   r   rM     s    c                s    g | ]\}}}}} j | qS r   )r   )rK   r   rx   r   r   r   )r)   r   r   rM     s    c             S   s   g | ]\}}}}}|qS r   r   )rK   r   rx   r   r   r   r   r   r   rM     s    c             S   s   g | ]\}}}}}|qS r   r   )rK   r   rx   r   r   r   r   r   r   rM     s    r      )Z_Ar   _facecolorsr   r   Zproj_transform_vecr   r/   r   r   r   repeatr   sorted	enumeraterP   r    r   r
   r   r   r   _facecolors2d_edgecolors2dr_   r   r   r   rf   r   )
r)   r2   ZxyzlistZcfaceZcedgeZz_segments_2drg   rZ   ZzvecZztransr   )r)   r   r   r   r   rh   i  sH    



z!Poly3DCollection.do_3d_projectionc             C   s   t | | t | | _d S )N)r
   set_facecolorro   r   )r)   r   r   r   r   r     s    zPoly3DCollection.set_facecolorc             C   s   t | | t | | _d S )N)r
   set_edgecolorr   r   )r)   r   r   r   r   r     s    zPoly3DCollection.set_edgecolorc          
   C   s   |dk	r2yt | W n tk
r0   tdY nX tj| | yt| j| j| _	W n t
ttfk
rp   Y nX yt| j| j| _W n t
ttfk
r   Y nX d| _dS )z
        Set the alpha transparencies of the collection.

        Parameters
        ----------
        alpha : float or None
        Nzalpha must be a float or NoneT)rC   rD   r   ZArtist	set_alphar   r   r   r   r   AttributeError
IndexErrorr   Z_edgecolorsr-   )r)   Zalphar   r   r   r     s"    zPoly3DCollection.set_alphac             C   s   | j S )N)r   )r)   r   r   r   ro     s    zPoly3DCollection.get_facecolorc             C   s   | j S )N)r   )r)   r   r   r   r     s    zPoly3DCollection.get_edgecolor)T)r4   r5   r6   r7   r'   r   r   rf   r   r   r   r   r   r   r(   ra   rh   r   r   r   ro   r   r   r   r   )r9   r   r     s"   

<r   c             C   s2   t |  ||\}}t| _| || |   dS )z6Convert a PolyCollection to a Poly3DCollection object.N)r]   ri   r   r9   r   r(   )rj   rA   r!   Zsegments_3drZ   r   r   r   poly_collection_2d_to_3d  s
    r   c             C   sL   |dkr|| |fS |dkr$| ||fS |d dkr>t | |||S | ||fS dS )z
    Reorder coordinates so that 2D xs, ys can be plotted in the plane
    orthogonal to zdir. zdir is normally x, y or z. However, if zdir
    starts with a '-' it is interpreted as a compensation for rotate_axes.
    r   r   r   -N)rotate_axes)r?   r@   rA   r!   r   r   r   rE     s    

rE   c             C   sV   |dkr||| fS |dkr$|| |fS |dkr6|| |fS |dkrH||| fS | ||fS dS )z
    Reorder coordinates so that the axes are rotated with zdir along
    the original z axis. Prepending the axis with a '-' does the
    inverse transform, so zdir can be x, -x, y, -y, z or -z
    r   z-xr   z-yNr   )r?   r@   rA   r!   r   r   r   r     s    



r   c             C   s*   t t| rt| n
ddddg|dfS )z@Stretch the color argument to provide the required number *num*.r      )r   rN   r   r   r   )cZnumr   r   r   
get_colors  s    r   c             C   sP   t | t|} t|rLtt|t|}d||d  }dd t| |D } | S )z7Modify the alphas of the color list according to depth.r   gffffff?c             S   s0   g | ](\}}|d  |d |d |d | fqS )r   r   r   r   r   )rK   r   rx   r   r   r   rM     s    zzalpha.<locals>.<listcomp>)r   r   r   rf   r   rP   )r   rA   ZnormZsatsr   r   r   r     s    r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   )r   r   T)r   r   )7r7   r0   Znumpyr   Z
matplotlibr   r   r   r   r   r   r%   r   rv   Zmatplotlib.collectionsr   r	   r
   r   r   Zmatplotlib.colorsr   Zmatplotlib.patchesr   r$   r   r   r   r"   r&   r#   r;   r=   r<   rH   rT   rX   r[   r]   r^   rl   rm   r}   r   r   r   r   r   r   r   r   rE   r   r   r   r   r   r   r   <module>   sF    #4
"



	

(



BB
 R
	