
 m[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	 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 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   Z$ d   Z% d   Z& d e j' f d     YZ( d d d  Z) d e j* f d     YZ+ d d d  Z, d d d  Z- d d d  Z. d d d  Z/ d d d  Z0 d e f d     YZ1 d d d  Z2 d e! f d     YZ3 d e3 f d      YZ4 d!   Z5 d d d"  Z6 d d d#  Z7 d$ e f d%     YZ8 d& e f d'     YZ9 d d e: d(  Z; d) e f d*     YZ< d d d+  Z= d,   Z> d-   Z? d.   Z@ d/   ZA d S(0   ux   
Module containing 3D artist code and functions to convert 2D
artists into 3D versions which can be added to an Axes3D.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   zip(   t   artistt   cbookt   colorst   linest   textt   path(   t
   _backports(   t
   Collectiont   LineCollectiont   PolyCollectiont   PatchCollectiont   PathCollection(   t	   Normalize(   t   Patchi   (   t   proj3dc         C` s+   |  d d }  |  d k r' |  d }  n  |  S(   u"   Return angle between -180 and +180ih  i   (    (   t   a(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt
   norm_angle   s    c         C` s+   |  d d }  |  d k r' |  d }  n  |  S(   u    Return angle between -90 and +90i   iZ   (    (   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   norm_text_angle&   s    c         C` s   |  d k r t  j d  S|  d k r2 t  j d	  S|  d k rK t  j d
  S|  d  k rd t  j d  St j |   r t |   d k r |  St d   d  S(   Nu   xi   i    u   yu   zi   u2   'x', 'y', 'z', None or vector of length 3 expected(   i   i    i    (   i    i   i    (   i    i    i   (   i    i    i    (   t   npt   arrayt   NoneR   t   iterablet   lent
   ValueError(   t   zdir(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   get_dir_vector.   s    !t   Text3Dc           B` s>   e  Z d  Z d d d d d d  Z d d d  Z d   Z RS(   uE   
    Text object with 3D position and (in the future) direction.
    i    u    u   zc         K` s0   t  j j |  | | | |  |  j | |  d S(   u   
        *x*, *y*, *z*  Position of text
        *text*         Text string to display
        *zdir*         Direction of text

        Keyword arguments are passed onto :func:`~matplotlib.text.Text`.
        N(   t   mtextt   Textt   __init__t   set_3d_properties(   t   selft   xt   yt   zR	   R   t   kwargs(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"   B   s    c         C` sI   |  j    \ } } t j | | | f  |  _ t |  |  _ t |  _ d  S(   N(   t   get_positionR   R   t   _position3dR   t   _dir_vect   Truet   stale(   R$   R'   R   R%   R&   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#   M   s    c         C` s   t  j |  j |  j |  j g | j  } | d d | d d } | d d | d d } | d k r} | d k r} d } n t j t j | |   } |  j | d d | d d f  |  j	 t
 |   t j j |  |  t |  _ d  S(   Ni    i   g        (   R   t   proj_trans_pointsR*   R+   t   Mt   matht   degreest   atan2t   set_positiont   set_rotationR   R    R!   t   drawt   FalseR-   (   R$   t   renderert   projt   dxt   dyt   angle(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR5   S   s    "	#(   t   __name__t
   __module__t   __doc__R"   R#   R5   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR   =   s   u   zc         C` s   t  |  _ |  j | |  d S(   u"   Convert a Text to a Text3D object.N(   R   t	   __class__R#   (   t   objR'   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   text_2d_to_3dc   s    	t   Line3Dc           B` s/   e  Z d  Z d   Z d d d  Z d   Z RS(   u   
    3D line object.
    c         O` s2   t  j j |  g  g  | |  | | | f |  _ d S(   uU   
        Keyword arguments are passed onto :func:`~matplotlib.lines.Line2D`.
        N(   R   t   Line2DR"   t   _verts3d(   R$   t   xst   yst   zst   argsR(   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"   n   s    i    u   zc         C` sz   |  j    } |  j   } y) t |  } g  | D] } | ^ q. } Wn t k
 rT n Xt | | | |  |  _ t |  _ d  S(   N(   t	   get_xdatat	   get_ydatat   floatt	   TypeErrort   juggle_axesRD   R,   R-   (   R$   RG   R   RE   RF   R%   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#   u   s    c         C` sf   |  j  \ } } } t j | | | | j  \ } } } |  j | |  t j j |  |  t |  _	 d  S(   N(
   RD   R   t   proj_transformR/   t   set_dataR   RC   R5   R6   R-   (   R$   R7   t   xs3dt   ys3dt   zs3dRE   RF   RG   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR5      s
    $(   R<   R=   R>   R"   R#   R5   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRB   i   s   	c         C` s   t  |  _ |  j | |  d S(   u"   
    Convert a 2D line to 3D.
    N(   RB   R?   R#   (   t   lineRG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   line_2d_to_3d   s    	c   
      C` s   t  j | t |    } |  j d t d t  } g  t | |  D]' \ \ \ } } } } | | | f ^ q@ } g  | D]$ \ } } } t | | | |  ^ qt }	 |	 S(   u   Convert a path to a 3D segment.t   simplifyt   curves(   R   t   broadcast_toR   t   iter_segmentsR6   R   RM   (
   R
   RG   R   t   pathsegsR%   R&   t   codeR'   t   segt   seg3d(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   path_to_3d_segment   s
    =1c         C` sP   t  j | t |    } g  t |  |  D] \ } } t | | |  ^ q( } | S(   u@   
    Convert paths from a collection object to 3D segments.
    (   R   RW   R   R   R]   (   t   pathsRG   R   R
   t   pathzt   segs(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   paths_to_3d_segments   s    1c         C` s   t  j | t |    } g  } g  } |  j d t d t  } xL t | |  D]; \ \ \ } } } }	 | j | | |	 f  | j |  qL Wg  | D]$ \ } } }	 t | | |	 |  ^ q }
 |
 | f S(   u/   Convert a path to a 3D segment with path codes.RU   RV   (   R   RW   R   RX   R6   R   t   appendRM   (   R
   RG   R   R[   t   codesRY   R%   R&   RZ   R'   R\   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   path_to_3d_segment_with_codes   s    (1c   	      C` s   t  j | t |    } g  } g  } xO t |  |  D]> \ } } t | | |  \ } } | j |  | j |  q4 W| | f S(   uP   
    Convert paths from a collection object to 3D segments with path codes.
    (   R   RW   R   R   Rd   Rb   (	   R^   RG   R   t   segmentst
   codes_listR
   R_   R`   Rc   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   paths_to_3d_segments_with_codes   s    t   Line3DCollectionc           B` s>   e  Z d  Z d   Z d   Z d   Z d   Z e d  Z RS(   u#   
    A collection of 3D lines.
    c         O` s   t  j |  | | |  d S(   uc   
        Keyword arguments are passed onto :func:`~matplotlib.collections.LineCollection`.
        N(   R   R"   (   R$   Re   RH   R(   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"      s    c         C` s   | |  _  t |  _ d S(   u&   Set the position to use for z-sorting.N(   t
   _sort_zposR,   R-   (   R$   t   val(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   set_sort_zpos   s    	c         C` s&   t  j |  |  _ t j |  g   d S(   u!   
        Set 3D segments
        N(   R   t
   asanyarrayt   _segments3dR   t   set_segments(   R$   Re   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRn      s    c   	      C` s   g  |  j  D] } t j | | j  ^ q
 } g  | D]$ \ } } } t j | | g  ^ q2 } t j |  |  d } x, | D]$ \ } } } t | t |   } qy W| S(   uB   
        Project the points according to renderer matrix.
        g    eA(	   Rm   R   R.   R/   R   t   column_stackR   Rn   t   min(	   R$   R7   t   pointst   xyslistRE   RF   RG   t   segments_2dt   minz(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   do_3d_projection   s    (1c         C` s*   | r |  j  |  n  t j |  |  d  S(   N(   Ru   R   R5   (   R$   R7   t   project(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR5      s    (	   R<   R=   R>   R"   Rk   Rn   Ru   R6   R5   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRh      s   				c         C` s2   t  |  j   | |  } t |  _ |  j |  d S(   u6   Convert a LineCollection to a Line3DCollection object.N(   Ra   t	   get_pathsRh   R?   Rn   (   t   colRG   R   t
   segments3d(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   line_collection_2d_to_3d   s    	t   Patch3Dc           B` sJ   e  Z d  Z d   Z d d d  Z d   Z d   Z d   Z d   Z RS(	   u   
    3D patch object.
    c         O` sK   | j  d g   } | j  d d  } t j |  | |  |  j | |  d  S(   Nu   zsu   zdiru   z(   t   popR   R"   R#   (   R$   RH   R(   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"      s    i    u   zc         C` sn   t  j | t |   } g  t | |  D]' \ \ } } } t | | | |  ^ q( |  _ t j |   |  _ d  S(   N(	   R   RW   R   R   RM   t
   _segment3dR   t   get_facecolort   _facecolor3d(   R$   t   vertsRG   R   R%   R&   R'   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#     s    =c         C` s   |  j  S(   N(   t   _path2d(   R$   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   get_path
  s    c         C` s   |  j  S(   N(   t   _facecolor2d(   R$   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR~     s    c   
      C` s|   |  j  } t |   \ } } } t j | | | | j  \ } } } }	 t j t j | | g   |  _	 |  j
 |  _ t |  S(   N(   R}   R   R   t   proj_transform_clipR/   t   mpatht   PathR   Ro   R   R   R   Rp   (
   R$   R7   t   sRE   RF   RG   t   vxst   vyst   vzst   vis(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRu     s    	'!c         C` s   t  j |  |  d  S(   N(   R   R5   (   R$   R7   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR5     s    (	   R<   R=   R>   R"   R#   R   R~   Ru   R5   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR{      s   					t   PathPatch3Dc           B` s/   e  Z d  Z d   Z d d d  Z d   Z RS(   u   
    3D PathPatch object.
    c         K` sK   | j  d g   } | j  d d  } t j |  |  |  j | | |  d  S(   Nu   zsu   zdiru   z(   R|   R   R"   R#   (   R$   R
   R(   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"   "  s    i    u   zc         C` s/   t  j |  | j d | d | | j |  _ d  S(   NRG   R   (   R{   R#   t   verticesRc   t   _code3d(   R$   R
   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#   (  s    c   
      C` s   |  j  } t |   \ } } } t j | | | | j  \ } } } }	 t j t j | | g  |  j	  |  _
 |  j |  _ t |  S(   N(   R}   R   R   R   R/   R   R   R   Ro   R   R   R   R   Rp   (
   R$   R7   R   RE   RF   RG   R   R   R   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRu   ,  s    	''(   R<   R=   R>   R"   R#   Ru   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s   	c         C` sC   |  j    } |  j   } | j |  } t |  r; | d Sg  Sd S(   u2   Return a list of vertices for the path of a patch.i    N(   t   get_patch_transformR   t   to_polygonsR   (   t   patcht   transR
   t   polygons(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   get_patch_verts6  s    c         C` s,   t  |   } t |  _ |  j | | |  d S(   u$   Convert a Patch to a Patch3D object.N(   R   R{   R?   R#   (   R   R'   R   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   patch_2d_to_3dA  s    	c         C` sG   |  j    } |  j   } | j |  } t |  _ |  j | | |  d S(   u,   Convert a PathPatch to a PathPatch3D object.N(   R   R   t   transform_pathR   R?   R#   (   t	   pathpatchR'   R   R
   R   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   pathpatch_2d_to_3dH  s
    	t   Patch3DCollectionc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   u%   
    A collection of 3D patches.
    c         O` s`   | j  d d  } | j  d d  } | j  d t  |  _ t j |  | |  |  j | |  d S(   u  
        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.
        u   zsi    u   zdiru   zu
   depthshadeN(   R|   R,   t   _depthshadeR   R"   R#   (   R$   RH   R(   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"   W  s
    c         C` s   | |  _  t |  _ d S(   u&   Set the position to use for z-sorting.N(   Ri   R,   R-   (   R$   Rj   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRk   m  s    	c         C` s   |  j    |  j   } t |  d k r= t |   \ } } n g  } g  } t | | t j |  |  |  _ |  j   |  _	 |  j
   |  _ t |  _ d  S(   Ni    (   t   update_scalarmappablet   get_offsetsR   R   RM   R   t
   atleast_1dt
   _offsets3dR~   R   t   get_edgecolort   _edgecolor3dR,   R-   (   R$   RG   R   t   offsetsRE   RF   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#   r  s    
!c         C` s  |  j  \ } } } t j | | | | j  \ } } } } |  j rT t |  j |  n |  j }	 t j |	 |  j	  }	 |  j
 |	  |  j r t |  j |  n |  j }
 t j |
 |  j	  }
 |  j |
  t j |  t j | | g   | j d k r t |  St j Sd  S(   Ni    (   R   R   R   R/   R   t   zalphaR   t   mcolorst   to_rgba_arrayt   _alphat   set_facecolorsR   t   set_edgecolorsR   t   set_offsetsR   Ro   t   sizeRp   t   nan(   R$   R7   RE   RF   RG   R   R   R   R   t   fcst   ecs(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRu     s    '		
(   R<   R=   R>   R"   Rk   R#   Ru   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR   R  s
   			t   Path3DCollectionc           B` s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   u#   
    A collection of 3D paths.
    c         O` s`   | j  d d  } | j  d d  } | j  d t  |  _ t j |  | |  |  j | |  d S(   u  
        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.
        u   zsi    u   zdiru   zu
   depthshadeN(   R|   R,   R   R   R"   R#   (   R$   RH   R(   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"     s
    c         C` s   | |  _  t |  _ d S(   u&   Set the position to use for z-sorting.N(   Ri   R,   R-   (   R$   Rj   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRk     s    	c         C` s   |  j    |  j   } t |  d k r= t |   \ } } n g  } g  } t | | t j |  |  |  _ |  j   |  _	 |  j
   |  _ t |  _ d  S(   Ni    (   R   R   R   R   RM   R   R   R   R~   R   R   R   R,   R-   (   R$   RG   R   R   RE   RF   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#     s    
!c         C` s  |  j  \ } } } t j | | | | j  \ } } } } |  j rT t |  j |  n |  j }	 t j |	 |  j	  }	 |  j
 |	  |  j r t |  j |  n |  j }
 t j |
 |  j	  }
 |  j |
  t j |  t j | | g   | j d k r t |  St j Sd  S(   Ni    (   R   R   R   R/   R   R   R   R   R   R   R   R   R   R   R   R   Ro   R   Rp   R   (   R$   R7   RE   RF   RG   R   R   R   R   R   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRu     s    '		
(   R<   R=   R>   R"   Rk   R#   Ru   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s
   			c         C` sS   t  |  t  r t |  _ n t  |  t  r6 t |  _ n  | |  _ |  j | |  d S(   u:  
    Convert a :class:`~matplotlib.collections.PatchCollection` into a
    :class:`Patch3DCollection` object
    (or a :class:`~matplotlib.collections.PathCollection` into a
    :class:`Path3DCollection` object).

    Keywords:

    *za*            The location or locations to place the patches in the
                    collection along the *zdir* axis. Defaults to 0.

    *zdir*          The axis in which to place the patches. Default is "z".

    *depthshade*    Whether to shade the patches to give a sense of depth.
                    Defaults to *True*.

    N(   t
   isinstanceR   R   R?   R   R   R   R#   (   Rx   RG   R   t
   depthshade(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   patch_collection_2d_to_3d  s    	t   Poly3DCollectionc           B` s   e  Z d  Z d   Z i e j d 6e j d 6e j d 6Z d   Z	 d   Z
 e d  Z d   Z d	   Z d
   Z d   Z d   Z e Z d   Z e Z d   Z d   Z e Z d   Z e Z d   Z RS(   u&   
    A collection of 3D polygons.
    c         O` sB   | j  d t  } t j |  | | |  |  j |  d |  _ d S(   u  
        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.
        u   zsortN(   R|   R,   R   R"   t	   set_zsortR   t   _codes3d(   R$   R   RH   R(   t   zsort(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR"     s    u   averageu   minu   maxc         C` su   | t  k r d } n  | t k	 rG | |  j k r@ |  j | } qM t Sn d } | |  _ d |  _ | |  _ t  |  _ d S(   u   
        Set z-sorting behaviour:
            boolean: if True use default 'average'
            string: 'average', 'min' or 'max'
        u   averageN(   R,   R6   t   _zsort_functionsR   t   _zsortRi   t
   _zsortfuncR-   (   R$   R   t	   zsortfunc(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    				c         C` s   d } d } g  } g  } xD | D]< } | j  |  | t |  } | j | | f  | } q Wt |  r t |   \ } } }	 n g  g  g  } } }	 t j t |   }
 t j | | |	 |
 g  |  _ | |  _ d S(   u   Optimize points for projectioni    N(	   t   extendR   Rb   R   R   t   onesR   t   _vect   _segis(   R$   Ry   t   sit   eit   segisRq   t   pRE   RF   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt
   get_vector'  s    
c         C` s-   |  j  |  t j |  g  t  | |  _ d S(   u   Set 3D vertices.N(   R   R   t	   set_vertsR6   t   _closed(   R$   R   t   closed(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR   =  s    c         C` s    |  j  | d t | |  _ d S(   u    Sets 3D vertices with path codesR   N(   R   R6   R   (   R$   R   Rc   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   set_verts_and_codesD  s    c         C` sc   |  j    d  |  _ |  j t  t j |   |  _ t j |   |  _	 t j
 |   |  _ t |  _ d  S(   N(   R   R   Ri   R   R,   R   t   get_facecolorst   _facecolors3dt   get_edgecolorst   _edgecolors3dt	   get_alphat   _alpha3dR-   (   R$   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR#   L  s    
	c         C` s   | |  _  t |  _ d S(   u&   Set the position to use for z-sorting.N(   Ri   R,   R-   (   R$   Rj   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRk   W  s    	c         ` s
    j  d
 k	 r(   j     j   _ n  t j   j | j  \ } } } g    j	 D]0 \ } } | | | !| | | !| | | !f ^ qS }   j }   j
 }	 t |  t |  k r | j t |  d d } n  t |	  t |  k r"t |	  d k r| }	 q"|	 j t |  d d }	 n    j rkt   f d   t t | | |	   D d d   d t }
 n t d   g  |
 D] \ } } } } } | ^ q~}   j d
 k	 rg  |
 D]" \ } } } } }   j | ^ q} t j   | |  n t j   |   j  g  |
 D] \ } } } } } | ^ q  _ t   j
  t |  k r}g  |
 D] \ } } } } } | ^ qV  _ n   j
   _   j d
 k	 rt j d g d g   j g d g g  } t j | | j  } | d	 d S| j d k rt j |  St j Sd
 S(   u<   
        Perform the 3D projection for this object.
        t   axisi    c         3` sT   |  ]J \ } \ \ } } } } }   j  |  t j | | g  | | | f Vq d  S(   N(   R   R   Ro   (   t   .0t   idxRE   RF   RG   t   fct   ec(   R$   (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pys	   <genexpr>w  s   t   keyc         S` s   |  d S(   Ni    (    (   R%   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   <lambda>z  s    t   reverseu   whoopsi   i   N(    t   _AR   R   t   _facecolorsR   R   t   proj_transform_vecR   R/   R   R   R   t   repeatR   t   sortedt	   enumerateR   R,   R   R   R   R   R   R   t   _facecolors2dt   _edgecolors2dRi   R   R   R   Rp   R   (   R$   R7   t   txst   tyst   tzsR   R   t   xyzlistt   cfacet   cedget   z_segments_2dR'   R   R   R   R   Rs   Rc   t   zvect   ztrans(    (   R$   s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRu   \  sH    
!=				(/+.*c         C` s&   t  j |  |  t  j |   |  _ d  S(   N(   R   t   set_facecolorR~   R   (   R$   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    c         C` s&   t  j |  |  t  j |   |  _ d  S(   N(   R   t   set_edgecolorR   R   (   R$   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    c         C` s   | d k	 r= y t |  Wq= t k
 r9 t d   q= Xn  t j j |  |  y t j |  j |  j	  |  _
 Wn t t t f k
 r n Xy t j |  j |  j	  |  _ Wn t t t f k
 r n Xt |  _ d S(   u   
        Set the alpha tranparencies of the collection.  *alpha* must be
        a float or *None*.

        ACCEPTS: float or None
        u   alpha must be a float or NoneN(   R   RK   RL   R   t   Artistt	   set_alphaR   R   R   R   R   t   AttributeErrort
   IndexErrorR   t   _edgecolorsR,   R-   (   R$   t   alpha(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s"    c         C` s   |  j  S(   N(   R   (   R$   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    c         C` s   |  j  S(   N(   R   (   R$   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    c         C` s   t  j |  |  S(   N(   R   R5   (   R$   R7   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR5     s    (   R<   R=   R>   R"   R   t   averageRp   t   maxR   R   R   R,   R   R   R#   Rk   Ru   R   R   R   R   R   R   R~   R   R   R5   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s.   	

						<					c         C` sE   t  |  j   | |  \ } } t |  _ |  j | |  |  j   d S(   u6   Convert a PolyCollection to a Poly3DCollection object.N(   Rg   Rw   R   R?   R   R#   (   Rx   RG   R   t   segments_3dRc   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   poly_collection_2d_to_3d  s
    	c         C` sf   | d k r | |  | f S| d k r2 |  | | f S| d d k rU t  |  | | |  S|  | | f Sd S(   u   
    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.
    u   xu   yi    u   -N(   t   rotate_axes(   RE   RF   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyRM     s    c         C` su   | d k r | | |  f S| d k r2 | |  | f S| d k rK | |  | f S| d k rd | | |  f S|  | | f Sd S(   u   
    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
    u   xu   -xu   yu   -yN(    (   RE   RF   RG   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    c         C` s=   t  j t |   r! t j |   n d d d d g | d f  S(   u=   Stretch the color argument to provide the required number numi    i   (   R   RW   R   R   R   (   t   ct   num(    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt
   get_colors  s    *c         C` s   t  |  t |   }  t |  r t t |  t |   } d | |  d } g  t |  |  D]2 \ } } | d | d | d | d | f ^ q` }  n  |  S(   u6   Modify the alphas of the color list according to depthi   gffffff?i    i   i   (   R   R   R   Rp   R   R   (   R   RG   t   normt   satsR   R   (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyR     s    K(B   R>   t
   __future__R    R   R   R   t   sixt	   six.movesR   R0   t   numpyR   t
   matplotlibR   R   R   R   R   R	   R    R
   R   t   matplotlib.cbookR   t   matplotlib.collectionsR   R   R   R   R   t   matplotlib.colorsR   t   matplotlib.patchesR   t    R   R   R   R   R!   R   RA   RC   RB   RT   R]   Ra   Rd   Rg   Rh   Rz   R{   R   R   R   R   R   R   R,   R   R   R   RM   R   R   R   (    (    (    s9   lib/python2.7/site-packages/mpl_toolkits/mplot3d/art3d.pyt   <module>   sL   ".(			&"
-$	
DD				