
 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 m	 Z	 m
 Z
 m Z d d l Z d d l Z d d l m Z d d l Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j Z  d d l! j" Z# d d l m$ Z$ m% Z% d d l m& Z& d d l m' Z' m( Z( d d	 l! m) Z) d d
 l* m+ Z+ d d l, m- Z- d d l, m. Z. d d l, m/ Z/ d   Z0 d e$ f d     YZ1 d d  Z2 d d l3 j4 Z5 e5 j6 j7 e1  d S(   uR  
axes3d.py, original mplot3d version by John Porter
Created: 23 Sep 2005

Parts fixed by Reinier Heeres <reinier@heeres.eu>
Minor additions by Ben Axelrod <baxelrod@coroware.com>
Significant updates and revisions by Ben Root <ben.v.root@gmail.com>

Module containing Axes3D, an object which can plot 3D objects on a
2D matplotlib figure.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   mapt   xranget   zipt   reduce(   t   defaultdict(   t   Axest   rcParams(   t
   _backports(   t	   Normalizet   LightSource(   t   Bbox(   t   Triangulationi   (   t   art3d(   t   proj3d(   t   axis3dc          C` s+   t  t j d d g d d g g   }  |  S(   Ni    i   (   R   t   npt   array(   t   box(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt	   unit_bbox*   s    't   Axes3Dc           B` s  e  Z d  Z d Z e j   Z dn d  Z d   Z	 d   Z
 d   Z d   Z dn dn dn dn d  Z d   Z d	   Z d
   Z d   Z dn d  Z dn dn d  Z dn dn d  Z d   Z d   Z e e e d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e  d dn d  Z! dn dn d  Z" dn e  e  e  d  Z# d   Z$ dn dn d  Z% dn dn e  e d  Z& e& Z' dn dn e  e d   Z( e( Z) dn dn e  e d!  Z* e* Z+ d"   Z, e- j. j/ j e, _ e, Z/ e/ j dn k	 re/ j d# 7_ n  d$   Z0 e- j. j1 j e0 _ e0 Z1 e1 j dn k	 r7e1 j d% 7_ n  d&   Z2 e2 Z3 d'   Z4 d(   Z5 e- j. j5 j dn k	 re- j. j5 j d) e5 _ n  d*   Z6 e- j. j6 j dn k	 re- j. j6 j d) e6 _ n  e7 j8 d+    Z9 d,   Z: e d-  Z; d.   Z< d/   Z= d0   Z> e d1  Z? dn d2  Z@ d3   ZA d4   ZB dn dn d5  ZC d6   ZD d7   ZE d8 d9 d:  ZF d;   ZG d<   ZH d=   ZI d>   ZJ d?   ZK d@   ZL dA   ZM dB   ZN dC   ZO dn dn dD  ZP dE   ZQ dF   ZR dG   ZS dH   ZT dI   ZU e  dJ  ZV dK   ZW d dn dL  ZX d dM  ZY dN   ZZ dO   Z[ dP   Z\ dn dn dQ  Z] dn dR  Z^ e^ Z_ e. j^ Z` dS   Za ea Zb dT   Zc dU   Zd dV   Ze dW   Zf dX   Zg dY   Zh dZ d[  Zi e dZ d\ dn d]  Zj d\ dn d^  Zk d_   Zl el Zm d`   Zn da   Zo eo Zp db   Zq dc d\ dd  Zr dc d\ de dn e  df  Zs es Zt dc d\ dg  Zu dn dh e  di  Zv dn dj dk  Zw e- j. jw j ew _ dl   Zx ex Zy dm   Zz RS(o   u   
    3D axes object.
    u   3dc   	      ` sw  d i d j  g  t j   D] } t |  ^ q  d 6| d  k rX d d d d g } n  g    _ | j d d    _ | j d d	    _ | j d
 d   } | j d d   }   j	 | j d d   t
     _ t
     _ t
     _ t
     _   j   j   j  d   _ |   _ | d  k	 rK  j j    |  d   _ n  t t    j | | d t | | t t    j     j   d    _ d    _ | d  k	 r  j |  n    j d  k	 r  j j j d   f d      _  n	 d    _  d   _   j!     j"     j# j$ d    j% j&   j' d d g  } | d | d \   _(   _)   j* j+    d  S(   Nu^  
        Build an :class:`Axes3D` instance in
        :class:`~matplotlib.figure.Figure` *fig* with
        *rect=[left, bottom, width, height]* in
        :class:`~matplotlib.figure.Figure` coordinates

        Optional keyword arguments:

          ================   =========================================
          Keyword            Description
          ================   =========================================
          *azim*             Azimuthal viewing angle (default -60)
          *elev*             Elevation viewing angle (default 30)
          *zscale*           [%(scale)s]
          *sharez*           Other axes to share z-limits with
          *proj_type*        'persp' or 'ortho' (default 'persp')
          ================   =========================================

        .. versionadded :: 1.2.1
            *sharez*

        u    | u   scaleg        g      ?u   azimiu   elevi   u   zscaleu   sharezu	   proj_typeu   perspi    u   datalimt   frameonu   units finalizec           ` s     j  d t  S(   Nt   scalez(   t   _on_units_changedt   True(    (   t   self(    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   <lambda>w   s    i   (   i    i    (   i   i   (,   t   joint   mscalet   get_scale_namest   reprt   Nonet   _cidst   popt   initial_azimt   initial_elevt   set_proj_typeR   t
   xy_viewLimt
   zz_viewLimt
   xy_dataLimt
   zz_dataLimt	   view_initt   _readyt   _sharezt   _shared_z_axest   _adjustablet   superR   t   __init__R   t   set_axis_offt   set_axis_ont   Mt	   fmt_zdatat
   set_zscalet   zaxist	   callbackst   connectt   _zcidt
   mouse_initt   set_top_viewt   patcht   set_linewidtht   transLimitst   invertedt	   transformt	   _pseudo_wt	   _pseudo_ht   figuret   add_axes(	   R   t   figt   rectt   argst   kwargst   xt   zscalet   sharezt   pseudo_bbox(    (   R   s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR2   6   sN    7			

				

c         C` s   t  |  _ t |  _ d  S(   N(   t   Falset	   _axis3donR   t   stale(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR3      s    	c         C` s   t  |  _ t  |  _ d  S(   N(   R   RP   RQ   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR4      s    	c         C` s+   |  j  j   p* |  j j   p* |  j j   S(   uN   
        Return *True* if units are set on the *x*, *y*, or *z* axes

        (   t   xaxist
   have_unitst   yaxisR8   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRS      s    c         C` s   |  j  j |  S(   u   
        For artists in an axes, if the zaxis has units support,
        convert *z* using zaxis unit type

        .. versionadded :: 1.2.1

        (   R8   t   convert_units(   R   t   z(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   convert_zunits   s    c         C` s   t  t |   j d | d | d |  |  j d k sR |  j d k sR |  j d k rV d S| d k	 r |  j j   s |  j j |  q n  | d k	 r | j	 d |  j j
  } | |  j j
 k r |  j j |  | d k	 r |  j j |  q q n  d S(   uT   
        Look for unit *kwargs* and update the axis instances as necessary

        t   xdatat   ydataRJ   Nu   zunits(   R1   R   t   _process_unit_infoRR   R"   RT   R8   RS   t   update_unitsR$   t   unitst	   set_units(   R   RX   RY   t   zdataRJ   t   zunits(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRZ      s    -c         C` sx   d |  j  } d |  j  } d |  j  } d |  j  } t t |   j | | d d  t t |   j | | d d  d  S(   Ngffffff?g?t   auto(   t   distR1   R   t   set_xlimR"   t   set_ylim(   R   t   xdwlt   xdwt   ydwlt   ydw(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR=      s     c         C` s   t  j d |  j j |  j j |   |  _ |  j |  _ t  j d |  j j |  j j |   |  _	 |  j	 |  _
 t  j d |  j j |  j j |   |  _ |  j |  _ x* |  j |  j
 |  j f D] } | j   q Wd S(   u4   Init 3D axes; overrides creation of regular X/Y axesu   xu   yu   zN(   R   t   XAxisR(   t	   intervalxR*   t   w_xaxisRR   t   YAxist	   intervalyt   w_yaxisRT   t   ZAxisR)   R+   t   w_zaxisR8   t   init3d(   R   t   ax(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   _init_axis   s    c         C` s   |  j  g t t |   j   S(   N(   R8   R1   R   t   get_children(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRs      s    c         C` s   t  t |   j   |  j f S(   N(   R1   R   t   _get_axis_listR8   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRt      s    c      
   C` s   | p |  j    \ } } } } } } | | | | | | | | g | | | | | | | | g | | | | | | | | g } }	 }
 t t | |	 |
   S(   N(   t
   get_w_limst   listR   (   R   t   valst   minxt   maxxt   minyt   maxyt   minzt   maxzt   xst   yst   zs(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt	   unit_cube   s
    $&c         C` s=   | d  k r |  j } n  |  j |  } t j | |  } | S(   N(   R"   R5   R   R   t   proj_points(   R   Rw   R5   t   xyzst   tcube(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   tunit_cube   s
    c         C` s   |  j  | |  } | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f | d | d f g } | S(	   Ni    i   i   i   i   i   i   i   (   R   (   R   Rw   R5   t   tct   edges(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   tunit_edges   s    c   	      ` s  |  j  j    t |  _ |  j   } | rJ | |     } |  j |  n
 |  j   |  j   |  _ |  j   _ |  j   _ |  j	   _	 |  j
   _
 xA t t |  j d   f d   d t  D] \ } } | | _ q WxA t t |  j d   f d   d t  D] \ } } | | _ qW|  j r{|  j |  j |  j f } x | D] } | j    qCWx | D] } | j    qaWn  t t |   j    d  S(   Nt   keyc         ` s   |  j     S(   N(   t   do_3d_projection(   t   col(   t   renderer(    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    t   reversec         ` s   |  j     S(   N(   R   (   R>   (   R   (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    (   R>   t   drawRO   t   _frameont   get_axes_locatort   apply_aspectt   get_projR5   t   vvect   eyet   get_axis_positiont	   enumeratet   sortedt   collectionsR   t   zordert   patchesRP   RR   RT   R8   t	   draw_paneR1   R   (	   R   R   t   locatort   post   iR   R>   t   axesRq   (    (   R   s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR      s:    	
	c         C` s   |  j    } |  j | |  j  } | d d | d d k } | d d | d d k } | d d | d d k } | | | f S(   Ni   i   i   i    (   Ru   R   R5   (   R   Rw   R   t   xhight   yhight   zhigh(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   /  s    c         C` s*   |  j    |  j d | d | d |  d S(   u   
        Callback for processing changes to axis units.

        Currently forces updates of data limits and view limits.
        t   scalext   scaleyR   N(   t   relimt   autoscale_view(   R   R   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   7  s    
c         K` s   d  S(   N(    (   R   t   xysRJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   update_datalim@  s    c         C` s   t  t |   j   o |  j   S(   u   
        Get whether autoscaling is applied for all axes on plot commands

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        (   R1   R   t   get_autoscale_ont   get_autoscalez_on(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   C  s    c         C` s   |  j  S(   u   
        Get whether autoscaling for the z-axis is applied on plot commands

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        (   t   _autoscaleZon(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   L  s    c         C` s'   t  t |   j |  |  j |  d S(   u	  
        Set whether autoscaling is applied on plot commands

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.

        Parameters
        ----------
        b : bool
            .. ACCEPTS: bool
        N(   R1   R   t   set_autoscale_ont   set_autoscalez_on(   R   t   b(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   U  s    c         C` s   | |  _  d S(   u  
        Set whether autoscaling for the z-axis is applied on plot commands

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.

        Parameters
        ----------
        b : bool
            .. ACCEPTS: bool
        N(   R   (   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   d  s    c         C` s=   | d k  s | d k r' t  d   n  | |  _ t |  _ d S(   uU  
        Set padding of Z data limits prior to autoscaling.

        *m* times the data interval will be added to each
        end of that interval before it is used in autoscaling.

        accepts: float in range 0 to 1

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        i    i   u   margin must be in range 0 to 1N(   t
   ValueErrort   _zmarginR   RQ   (   R   t   m(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   set_zmarginr  s    	c   
   	   O` s  | r$ | r$ |  j  |  j |  j f S| j d t  } | j d d  } | j d d  } | j d d  } | su n t |  d k r | d } } } nd t |  d k r t j d t	 j
  | \ } } n0 t |  d	 k r | \ } } } n t d
   | d k	 r|  j |  n  | d k	 r8|  j |  n  | d k	 rT|  j |  n  | d k	 } | d k	 } | d k	 }	 |  j d | d | d | d |	  d S(   u  
        Convenience method to set or retrieve autoscaling margins.

        signatures::
            margins()

        returns xmargin, ymargin, zmargin

        ::

            margins(margin)

            margins(xmargin, ymargin, zmargin)

            margins(x=xmargin, y=ymargin, z=zmargin)

            margins(..., tight=False)

        All forms above set the xmargin, ymargin and zmargin
        parameters. All keyword parameters are optional.  A single argument
        specifies xmargin, ymargin and zmargin.  The *tight* parameter
        is passed to :meth:`autoscale_view`, which is executed after
        a margin is changed; the default here is *True*, on the
        assumption that when margins are specified, no additional
        padding to match tick marks is usually desired.  Setting
        *tight* to *None* will preserve the previous setting.

        Specifying any margin changes only the autoscaling; for example,
        if *xmargin* is not None, then *xmargin* times the X data
        interval will be added to each end of that interval before
        it is used in autoscaling.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   tightu   xu   yu   zi   i    i   u|   Passing exactly two positional arguments to Axes3D.margins is deprecated.  If needed, pass them as keyword arguments insteadi   u7   Axes3D.margins takes at most three positional argumentst   tightR   R   R   N(   t   _xmargint   _ymarginR   R$   R   R"   t   lent   warningst   warnt   cbookt   mplDeprecationR   t   set_xmargint   set_ymarginR   R   (
   R   RI   t   kwR   t   mxt   myt   mzR   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   margins  s<    $
	u   bothc      	   C` s   | d	 k r! t } t } t } nx | d
 k rC t |  |  _ } n t } | d k rk t |  |  _ } n t } | d k r t |  |  _ } n t } |  j d | d | d | d |  d	 S(   u  
        Convenience method for simple axis view autoscaling.
        See :meth:`matplotlib.axes.Axes.autoscale` for full explanation.
        Note that this function behaves the same, but for all
        three axes.  Therefore, 'z' can be passed for *axis*,
        and 'both' applies to all three axes.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   xu   bothu   yu   zR   R   R   R   N(   u   xu   both(   u   yu   both(   u   zu   both(   R"   R   t   boolt   _autoscaleXonRO   t   _autoscaleYonR   R   (   R   t   enablet   axisR   R   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt	   autoscale  s    	c         C` s   t  t j | | | f  \ } } } y8 | j   | j   } } | d  k	 r[ | j   } n  Wn t k
 rr   n X|  j j t j | | g  j	 |  | d  k	 r |  j
 j t j | | g  j	 |  n  |  j   d  S(   N(   R   R   t   asarrayt   flattenR"   t   AttributeErrorR*   t   update_from_data_xyR   t   TR+   R   (   R   t   Xt   Yt   Zt   had_dataRK   t   yRV   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   auto_scale_xyz  s    $&)c         C` s  |  j  s d S| d k rd |  j p^ t |  j  d k o^ t |  j  d k o^ t |  j  d k } n t |  } |  _ | r|  j r|  j	 j
 |   } g  | D] } | j ^ q } t j j |  }	 |  j j \ }
 } |  j j   } y | j |
 |  \ }
 } Wn5 t k
 r:t j |
 | d t d d \ }
 } n X|  j d k rr| |
 |  j } |
 | 8}
 | | 7} n  | s| j |
 |  \ }
 } n  |  j |
 |  n  | r|  j r|  j j
 |   } g  | D] } | j ^ q} t j j |  }	 |  j j \ } } |  j j   } y | j | |  \ } } Wn5 t k
 rit j | | d t d d \ } } n X|  j d k r| | |  j } | | 8} | | 7} n  | s| j | |  \ } } n  |  j | |  n  | r|  j r|  j  j
 |   } g  | D] } | j ^ q} t j j |  }	 |  j! j \ } } |  j" j   } y | j | |  \ } } Wn5 t k
 rt j | | d t d d \ } } n X|  j# d k r| | |  j# } | | 8} | | 7} n  | s| j | |  \ } } n  |  j$ | |  n  d S(   u  
        Autoscale the view limits using the data limits.
        See :meth:`matplotlib.axes.Axes.autoscale_view` for documentation.
        Note that this function applies to the 3D axes, and as such
        adds the *scalez* to the function arguments.

        .. versionchanged :: 1.1.0
            Function signature was changed to better match the 2D version.
            *tight* is now explicitly a kwarg and placed first.

        .. versionchanged :: 1.2.1
            This is now fully functional.

        Ni    t
   increasingt   expanderg?(%   R-   R"   t   _tightR   t   imagest   linesR   R   R   t   _shared_x_axest   get_siblingst   dataLimt   mtransformst   BboxBaset   unionR*   Ri   RR   t   get_major_locatort   nonsingularR   RO   R   t   view_limitst
   set_xboundR   t   _shared_y_axesRl   RT   R   t
   set_yboundR   R/   R+   R8   R   t
   set_zbound(   R   R   R   R   R   R   t   xsharedRq   t   dlt   bbt   x0t   x1t   xlocatort   deltat   ysharedt   y0t   y1t   ylocatort   zsharedt   z0t   z1t   zlocator(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     sz    	


c         C` sL   |  j    \ } } |  j   \ } } |  j   \ } } | | | | | | f S(   u   Get 3D world limits.(   t
   get_xlim3dt
   get_ylim3dt
   get_zlim3d(   R   Rx   Ry   Rz   R{   R|   R}   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRu   S  s    c         O` sW   | d  k r* t j |  r* | \ } } n  | | k rM | d 8} | d 7} n  | | f S(   Ng?(   R"   R   t   iterable(   R   t   xmint   xmaxRI   RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   _determine_limsZ  s    
c   	      K` sA  d | k r | j  d  } n  d | k r< | j  d  } n  | r[ t d t |    n  | d
 k r t j |  r | \ } } n  |  j d | | f  |  j | |  j  } |  j | |  j  } |  j	   \ } } | d
 k r | } n  | d
 k r| } n  | | k r't
 j d | | f  n  t j | | d t \ } } |  j j | |  \ } } | | f |  j _ | d
 k	 rt |  |  _ n  | r.|  j j d |   x |  j j |   D]k } | |  k	 r| j |  j j d t d	 | | j |  j k r'| j j d
 k	 r'| j j j   q'qqWn  t |  _ | | f S(   un   
        Set 3D x limits.

        See :meth:`matplotlib.axes.Axes.set_xlim` for full documentation.

        u   xminu   xmaxu   unrecognized kwargs: %sRX   uw   Attempting to set identical left==right results
in singular transformations; automatically expanding.
left=%s, right=%sR   u   xlim_changedt   emitR`   N(   R$   R   Rv   R"   R   R   RZ   t   _validate_converted_limitst   convert_xunitst   get_xlimR   R   R   R   RO   RR   t   limit_range_for_scaleR(   Ri   R   R   R9   t   processR   R   Rb   RE   t   canvast	   draw_idleR   RQ   (	   R   t   leftt   rightR   R`   R   t   old_leftt	   old_rightt   other(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_xlim3db  sF    				c   	      K` sA  d | k r | j  d  } n  d | k r< | j  d  } n  | r[ t d t |    n  | d
 k r t j |  r | \ } } n  |  j d | | f  |  j | |  j  } |  j | |  j  } |  j	   \ } } | d
 k r | } n  | d
 k r| } n  | | k r't
 j d | | f  n  t j | | d t \ } } |  j j | |  \ } } | | f |  j _ | d
 k	 rt |  |  _ n  | r.|  j j d |   x |  j j |   D]k } | |  k	 r| j |  j j d t d	 | | j |  j k r'| j j d
 k	 r'| j j j   q'qqWn  t |  _ | | f S(   un   
        Set 3D y limits.

        See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation.

        u   yminu   ymaxu   unrecognized kwargs: %sRY   uw   Attempting to set identical bottom==top results
in singular transformations; automatically expanding.
bottom=%s, top=%sR   u   ylim_changedR   R`   N(   R$   R   Rv   R"   R   R   RZ   R   t   convert_yunitst   get_ylimR   R   R   R   RO   RT   R   R(   Rl   R   R   R9   R   R   R   Rc   RE   R  R  R   RQ   (	   R   t   bottomt   topR   R`   R   t
   old_bottomt   old_topR  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_ylim3d  sF    				c   	      K` sA  d | k r | j  d  } n  d | k r< | j  d  } n  | r[ t d t |    n  | d
 k r t j |  r | \ } } n  |  j d | | f  |  j | |  j  } |  j | |  j  } |  j	   \ } } | d
 k r | } n  | d
 k r| } n  | | k r't
 j d | | f  n  t j | | d t \ } } |  j j | |  \ } } | | f |  j _ | d
 k	 rt |  |  _ n  | r.|  j j d |   x |  j j |   D]k } | |  k	 r| j |  j j d t d	 | | j |  j k r'| j j d
 k	 r'| j j j   q'qqWn  t |  _ | | f S(   um   
        Set 3D z limits.

        See :meth:`matplotlib.axes.Axes.set_ylim` for full documentation

        u   zminu   zmaxu   unrecognized kwargs: %sR^   uw   Attempting to set identical bottom==top results
in singular transformations; automatically expanding.
bottom=%s, top=%sR   u   zlim_changedR   R`   N(   R$   R   Rv   R"   R   R   RZ   R   RW   t   get_zlimR   R   R   R   RO   R8   R   R)   Ri   R   R   R9   R   R/   R   t   set_zlimRE   R  R  R   RQ   (	   R   R  R  R   R`   R   R  R  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_zlim3d  sF    				c         C` s   t  |  j j  S(   N(   t   tupleR(   Ri   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    uz   
            .. versionchanged :: 1.1.0
                This function now correctly refers to the 3D x-limits
            c         C` s   t  |  j j  S(   N(   R  R(   Rl   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    u{   
            .. versionchanged :: 1.1.0
                This function now correctly refers to the 3D y-limits.
            c         C` s   t  |  j j  S(   u   Get 3D z limits.(   R  R)   Ri   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    c         C` s$   d d j  t j    |  j j   S(   Nu   
        Return the zaxis scale string %s

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   , (   R   R   R    R8   t	   get_scale(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   get_zscale  s    c         K` s7   |  j  j | |  |  j d t d t  |  j   d  S(   NR   R   (   RR   t
   _set_scaleR   RO   t   _update_transScale(   R   t   valueRJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_xscale"  s    u   

            .. versionadded :: 1.1.0
                This function was added, but not tested. Please report any bugs.
            c         K` s@   |  j  j | |  |  j d t d t  |  j   t |  _ d  S(   NR   R   (   RT   R  R   RO   R  R   RQ   (   R   R  RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_yscale-  s    
c         K` s@   |  j  j | |  |  j d t d t  |  j   t |  _ d S(   u  
        Set the scaling of the z-axis: %(scale)s

        ACCEPTS: [%(scale)s]

        Different kwargs are accepted, depending on the scale:
        %(scale_docs)s

        .. note ::
            Currently, Axes3D objects only supports linear scales.
            Other scales may or may not work, and support for these
            is improving with each release.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        R   R   N(   R8   R  R   RO   R  R   RQ   (   R   R  RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR7   9  s    
c         O` s   |  j  j | |   S(   u   
        Set z-axis tick locations.
        See :meth:`matplotlib.axes.Axes.set_yticks` for more details.

        .. note::
            Minor ticks are not supported.

        .. versionadded:: 1.1.0
        (   R8   t	   set_ticks(   R   RI   RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_zticksP  s    
c         C` s   |  j  j d |  S(   u   
        Return the z ticks as a list of locations
        See :meth:`matplotlib.axes.Axes.get_yticks` for more details.

        .. note::
            Minor ticks are not supported.

        .. versionadded:: 1.1.0
        t   minor(   R8   t   get_ticklocs(   R   R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   get_zticks\  s    
c         C` s   t  j d |  j j    S(   ud   
        Get the ztick labels as a list of Text instances

        .. versionadded :: 1.1.0
        u   Text zticklabel(   R   t   silent_listR8   t   get_majorticklabels(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_zmajorticklabelsh  s    	c         C` s   t  j d |  j j    S(   u   
        Get the ztick labels as a list of Text instances

        .. note::
            Minor ticks are not supported. This function was added
            only for completeness.

        .. versionadded :: 1.1.0
        u   Text zticklabel(   R   R   R8   t   get_minorticklabels(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_zminorticklabelsq  s    
	c         O` s   |  j  j | |   S(   u   
        Set z-axis tick labels.
        See :meth:`matplotlib.axes.Axes.set_yticklabels` for more details.

        .. note::
            Minor ticks are not supported by Axes3D objects.

        .. versionadded:: 1.1.0
        (   R8   t   set_ticklabels(   R   RI   RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   set_zticklabels~  s    
c         C` s   t  j d |  j j d |   S(   u   
        Get ztick labels as a list of Text instances.
        See :meth:`matplotlib.axes.Axes.get_yticklabels` for more details.

        .. note::
            Minor ticks are not supported.

        .. versionadded:: 1.1.0
        u   Text zticklabelR  (   R   R   R8   t   get_ticklabels(   R   R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_zticklabels  s    
	c         C` s   |  j  j |  d S(   u  
        Sets up z-axis ticks and labels that treat the z data as dates.

        *tz* is a timezone string or :class:`tzinfo` instance.
        Defaults to rc value.

        .. note::
            This function is merely provided for completeness.
            Axes3D objects do not officially support dates for ticks,
            and so this may or may not work as expected.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        N(   R8   t	   axis_date(   R   t   tz(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   zaxis_date  s    c         C` s   |  j  j   S(   u   
        Get ztick lines as a list of Line2D instances.
        Note that this function is provided merely for completeness.
        These lines are re-calculated as the display changes.

        .. versionadded:: 1.1.0
        (   R8   t   get_ticklines(   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_zticklines  s    c         O` s   d S(   ua   
        This function is currently not implemented for 3D axes.
        Returns *None*.
        N(   R"   (   R   RI   RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   clabel  s    c         C` sU   d |  _  | d k r$ |  j |  _ n	 | |  _ | d k rH |  j |  _ n	 | |  _ d S(   u|  
        Set the elevation and azimuth of the axes.

        This can be used to rotate the axes programmatically.

        'elev' stores the elevation angle in the z plane.
        'azim' stores the azimuth angle in the x,y plane.

        if elev or azim are None (default), then the initial value
        is used which was specified in the :class:`Axes3D` constructor.
        i
   N(   Ra   R"   R&   t   elevR%   t   azim(   R   R/  R0  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR,     s    		c         C` sJ   | d k r t  j |  _ n+ | d k r6 t  j |  _ n t d |   d S(   u   
        Set the projection type.

        Parameters
        ----------
        proj_type : str
            Type of projection, accepts 'persp' and 'ortho'.

        u   perspu   orthou   unrecognized projection: %sN(   R   t   persp_transformationt   _projectiont   ortho_transformationR   (   R   t	   proj_type(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR'     s
    
c         C` s  t  j |  j d t  j |  j d } } |  j   \ } } |  j   \ } } |  j   \ } } t j | | | | | |  }	 t  j	 d d d g  }
 |
 d t  j
 |  t  j
 |  |  j } |
 d t  j |  t  j
 |  |  j } |
 d t  j |  |  j } t  j	 | | | f  } | |  _ |
 | |  _ |  j t j |  j  |  _ t |  t  j d k r~t  j	 d  } n t  j	 d  } |  j |  j } } t j | |
 |  } |  j | |  } t  j | |	  } t  j | |  } | S(	   u  
        Create the projection matrix from the current viewing position.

        elev stores the elevation angle in the z plane
        azim stores the azimuth angle in the x,y plane

        dist is the distance of the eye viewing point from the object
        point.

        i   g      ?i    i   i   i(   i    i    i(   i    i    i   (   R   t   piR/  R0  R   R   R   R   t   world_transformationR   t   cosRa   t   sinR   R   t   modt   abst   view_transformationR2  t   dot(   R   t   relevt   razimR   R   t   ymint   ymaxt   zmint   zmaxt   worldMt   Rt   xpt   ypt   zpt   Et   Vt   zfrontt   zbackt   viewMt   projMt   M0R5   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s0    )++	i   i   c         C` s   d |  _ |  j j } | d k	 ru | j d |  j  } | j d |  j  } | j d |  j  } | | | g |  _ n t	 j
 d  t j |  j   |  _ t j |  j   |  _ d S(   u"  Initializes mouse button callbacks to enable 3D rotation of
        the axes.  Also optionally sets the mouse buttons for 3D rotation
        and zooming.

        ============  =======================================================
        Argument      Description
        ============  =======================================================
        *rotate_btn*  The integer or list of integers specifying which mouse
                      button or buttons to use for 3D rotation of the axes.
                      Default = 1.

        *zoom_btn*    The integer or list of integers specifying which mouse
                      button or buttons to use to zoom the 3D axes.
                      Default = 3.
        ============  =======================================================

        u   motion_notify_eventu   button_press_eventu   button_release_eventuc   Axes3D.figure.canvas is 'None', mouse rotation disabled.  Set canvas then call Axes3D.mouse_init().N(   R"   t   button_pressedRE   R  t   mpl_connectt   _on_movet   _button_presst   _button_releaseR#   R   R   R   t
   atleast_1dt   tolistt   _rotate_btnt	   _zoom_btn(   R   t
   rotate_btnt   zoom_btnt   canvt   c1t   c2t   c3(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR<     s    	c         C` s   t  S(   u   
        Return *True* if this axes supports the zoom box button functionality.

        3D axes objects do not use the zoom box button.
        (   RO   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   can_zoom6  s    c         C` s   t  S(   u   
        Return *True* if this axes supports the pan/zoom button functionality.

        3D axes objects do not use the pan/zoom button.
        (   RO   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   can_pan>  s    c         C` s  t  t |   j   |  j j   |  j d k	 r |  j j j |  j _ |  j j j |  j _ |  j j   \ } } |  j	 | | d t
 d d |  j j |  j j j    n8 |  j j d  y |  j	 d d  Wn t k
 r n Xt |  _ d |  _ |  j t d  d S(   u   
        Clear axes
        R   R`   u   lineari    i   u   axes3d.gridN(   R1   R   t   claR8   R.   R"   t   majorR  R  R  RO   R  R  t	   TypeErrorR   R   R   t   gridR
   (   R   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR`  F  s     		c         C` s4   x$ |  j  D] } |  j j j |  q
 Wg  |  _  d S(   u(   Disable mouse button callbacks.
        N(   R#   RE   R  t   mpl_disconnect(   R   t   cid(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   disable_mouse_rotationb  s    c         C` s;   | j  |  k r7 | j |  _ | j | j |  _ |  _ n  d  S(   N(   t   inaxest   buttonRO  RX   RY   t   sxt   sy(   R   t   event(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRR  k  s    c         C` s   d  |  _ d  S(   N(   R"   RO  (   R   Rk  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRS  p  s    c         C` sN   y |  j  |  SWn6 t t f k
 rI |  j j   j } | |  } | SXd S(   u   
        Return *z* string formatted.  This function will use the
        :attr:`fmt_zdata` attribute if it is callable, else will fall
        back on the zaxis major formatter
        N(   R6   R   Rb  R8   t   get_major_formattert   format_data_short(   R   RV   t   funct   val(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   format_zdatas  s     c         ` s;  |  j  d k r d S|  j |  j k r9 d |  j |  j f St |  j   d    f d   \ } } | \ } } } | \ } }	 }
 t j	 |   |   } t j	 |   |	   } | | } | | | | | |
 } t
 j    | |  j   \ } } } |  j |  } |  j |  } |  j |  } d | | | f S(   u   
        Given the 2D view coordinates attempt to guess a 3D coordinate.
        Looks for the nearest edge to the point and then assumes that
        the point is at the same z location as the nearest point on the edge.
        u    u!   azimuth=%d deg, elevation=%d deg R   c         ` s!   t  j |  d |  d    f  S(   Ni    i   (   R   t   line2d_seg_dist(   t   edge(   t   xdt   yd(    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s   u   x=%s, y=%s, z=%sN(   R5   R"   RO  RV  R0  R/  t   minR   R   t   hypotR   t   inv_transformt   format_xdatat   format_ydataRp  (   R   Rs  Rt  t   p0t   p1R   R   R   R   R   R   t   d0t   d1t   dtRV   RK   R   R~   R   R   (    (   Rs  Rt  s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   format_coord  s"    
$c         C` s  |  j  s d S|  j d k r  d S| j | j } } | d k rC d S| |  j | |  j } } |  j } |  j } | | |  _ |  _ |  j  |  j	 k r| d k r | d k r d St
 j |  j | | d  |  _ t
 j |  j | | d  |  _ |  j   t |  _ |  j j j   n |  j  |  j k r|  j   \ } }	 }
 } } } d | | | } |	 | | } | |
 | } | | | } |  j | | |	 |  |  j |
 | | |  |  j | | | |  |  j   |  j j j   n  d S(   u   Mouse moving

        button-1 rotates by default.  Can be set explicitly in mouse_init().
        button-3 zooms by default.  Can be set explicitly in mouse_init().
        Ni    i   i   (   RO  R5   R"   RX   RY   Ri  Rj  RC   RD   RV  R   t
   norm_angleR/  R0  R   R   RQ   RE   R  R  RW  Ru   R  R  R  (   R   Rk  RK   R   t   dxt   dyt   wt   hRx   Ry   Rz   R{   R|   R}   t   dft   dz(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRQ    s<    			!!
		
c         K` s1   | d k	 r | |  j _ n  |  j j | | |  S(   uO   
        Set zlabel.  See doc for :meth:`set_ylabel` for description.

        N(   R"   R8   t   labelpadt   set_label_text(   R   t   zlabelt   fontdictR  RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   set_zlabel  s     c         C` s   |  j  j   } | j   S(   u   
        Get the z-label text string.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        (   R8   t	   get_labelt   get_text(   R   t   label(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   get_zlabel  s    c         C` s   |  j  S(   u]   
        Get whether the 3D axes panels are drawn.

        .. versionadded :: 1.1.0
        (   R   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_frame_on  s    c         C` s   t  |  |  _ t |  _ d S(   u   
        Set whether the 3D axes panels are drawn.

        .. versionadded :: 1.1.0

        Parameters
        ----------
        b : bool
            .. ACCEPTS: bool
        N(   R   R   R   RQ   (   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   set_frame_on  s    c         C` s   t  S(   u   
        Get whether axis below is true or not.

        For axes3d objects, this will always be *True*

        .. versionadded :: 1.1.0
            This function was added for completeness.
        (   R   (   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_axisbelow  s    	c         C` s   t  |  _ t  |  _ d S(   uS  
        Set whether axis ticks and gridlines are above or below most artists.

        For axes3d objects, this will ignore any settings and just use *True*

        .. versionadded :: 1.1.0
            This function was added for completeness.

        Parameters
        ----------
        b : bool
            .. ACCEPTS: bool
        N(   R   t
   _axisbelowRQ   (   R   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   set_axisbelow  s    	c         K` s4   t  |  r t } n  t j |  |  _ t |  _ d S(   ua  
        Set / unset 3D grid.

        .. note::

            Currently, this function does not behave the same as
            :meth:`matplotlib.axes.Axes.grid`, but it is intended to
            eventually support that behavior.

        .. versionchanged :: 1.1.0
            This function was changed, but not tested. Please report any bugs.
        N(   R   R   R   t   _string_to_boolt
   _draw_gridRQ   (   R   R   RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRc    s    	c   
      K` s  | j  d d  j   } | j  d d  } | j  d d  } | j  d d  j   } | d k	 r y | \ } } | | d Wq t t f k
 r t d   q Xn  | d	  d
 k r t } n] | d k r t } | d k r t }	 qt }	 t d   n! | d k rd } n t d   y~| d k	 r| d k rO|  j j	 j
 j |  n  | d k rt|  j j	 j
 j |  n  | d k r|  j j	 j
 j |  qn  | d k	 r| d k r|  j j	 j
 j |  n  | d k r|  j j	 j
 j |  n  | d k r|  j j	 j
 j |  qn  | d k	 r| d k rK|  j j	 j
 j |  n  | d k rp|  j j	 j
 j |  n  | d k r|  j j	 j
 j |  qn  Wn t k
 rt d   n Xd S(   u$  
        Convenience method for manipulating the ScalarFormatter
        used by default for linear axes in Axed3D objects.

        See :meth:`matplotlib.axes.Axes.ticklabel_format` for full
        documentation.  Note that this version applies to all three
        axes of the Axes3D object.  Therefore, the *axis* argument
        will also accept a value of 'z' and the value of 'both' will
        apply to all three axes.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   styleu    u	   scilimitsu	   useOffsetu   axisu   bothi   u*   scilimits must be a sequence of 2 integersi   u   sciu   plainu   commau   comma style remains to be addedu   %s is not a valid style valueu   zu   yu   xu0   This method only works with the ScalarFormatter.N(   u   plainu   comma(   u   bothu   z(   u   bothu   y(   u   bothu   z(   u   bothu   x(   u   bothu   y(   u   bothu   z(   u   bothu   x(   u   bothu   y(   u   bothu   z(   R$   t   lowerR"   R   Rb  R   RO   t   NotImplementedErrorRR   Ra  t	   formattert   set_scientificRT   R8   t   set_powerlimitst   set_useOffsetR   (
   R   RJ   t   stylet	   scilimitst	   useOffsetR   R   t   nt   sbt   cb(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   ticklabel_format2  s\    			 c      	   K` s   | d
 k } | d k } | d k } | rC |  j  j   j |   n  | rb |  j j   j |   n  | r |  j j   j |   n  |  j d | d | d | d |  d	 S(   u  
        Convenience method for controlling tick locators.

        See :meth:`matplotlib.axes.Axes.locator_params` for full
        documentation  Note that this is for Axes3D objects,
        therefore, setting *axis* to 'both' will result in the
        parameters being set for all three axes.  Also, *axis*
        can also take a value of 'z' to apply parameters to the
        z axis.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   xu   bothu   yu   zR   R   R   R   N(   u   xu   both(   u   yu   both(   u   zu   both(   RR   R   t
   set_paramsRT   R8   R   (   R   R   R   RJ   t   _xt   _yt   _z(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   locator_paramsq  s    c         K` s   t  t |   j | |  | d k r t |  } | j d d  | j d d  | j d d  | j d d  |  j j |   n  d S(	   u(  
        Convenience method for changing the appearance of ticks and
        tick labels.

        See :meth:`matplotlib.axes.Axes.tick_params` for more complete
        documentation.

        The only difference is that setting *axis* to 'both' will
        mean that the settings are applied to all three axes. Also,
        the *axis* parameter also accepts a value of 'z', which
        would mean to apply to only the z-axis.

        Also, because of how Axes3D objects are drawn very differently
        from regular 2D axes, some of these settings may have
        ambiguous meaning.  For simplicity, the 'z' axis will
        accept settings as if it was like the 'y' axis.

        .. note::
            While this function is currently implemented, the core part
            of the Axes3D object may ignore some of these settings.
            Future releases will fix this. Priority will be given to
            those who file bugs.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        u   zu   bothu   topu   bottomu   labeltopu   labelbottomN(   u   zu   both(   R1   R   t   tick_paramst   dictR$   R"   R8   t   set_tick_params(   R   R   RJ   t   zkw(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR    s    c         C` s,   |  j    \ } } |  j | | d d d S(   u   
        Invert the z-axis.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        R`   N(   R  R  R"   (   R   R  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   invert_zaxis  s    c         C` s   |  j    \ } } | | k  S(   u   
        Returns True if the z-axis is inverted.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        (   R  (   R   R  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   zaxis_inverted  s    c         C` s6   |  j    \ } } | | k  r( | | f S| | f Sd S(   u   
        Returns the z-axis numerical bounds where::

          lowerBound < upperBound

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        N(   R  (   R   R  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   get_zbound  s    	
c         C` s   | d k r* t j |  r* | \ } } n  |  j   \ } } | d k rQ | } n  | d k rf | } n  |  j   r | | k  r |  j | | d d q |  j | | d d n; | | k  r |  j | | d d n |  j | | d d d S(   uE  
        Set the lower and upper numerical bounds of the z-axis.
        This method will honor axes inversion regardless of parameter order.
        It will not change the :attr:`_autoscaleZon` attribute.

        .. versionadded :: 1.1.0
            This function was added, but not tested. Please report any bugs.
        R`   N(   R"   R   R   R  R  R  (   R   R  t   uppert	   old_lowert	   old_upper(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR     s    	 	 	c         K` s8   t  t |   j | | | |  } t j | | |  | S(   u   
        Add text to the plot. kwargs will be passed on to Axes.text,
        except for the `zdir` keyword, which sets the direction to be
        used as the z direction.
        (   R1   R   t   textR   t   text_2d_to_3d(   R   RK   R   RV   t   st   zdirRJ   R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR    s    !c   
      O` s  |  j    } | r[ t | d t j  r[ | d } | d } d | k rm t d   qm n | j d d  } | j d d  } t j | t |   } t	 t
 |   j | | | |  } x' | D] }	 t j |	 d | d | q Wt j | | | |  \ } } } |  j | | | |  | S(	   uo  
        Plot 2D or 3D data.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *xs*, *ys*  x, y coordinates of vertices

        *zs*        z value(s), either one for all points or one for
                    each point.
        *zdir*      Which direction to use as z ('x', 'y' or 'z')
                    when plotting a 2D set.
        ==========  ================================================

        Other arguments are passed on to
        :func:`~matplotlib.axes.Axes.plot`
        i    i   u   zsu+   plot() for multiple values for argument 'z'u   zdiru   zR   R  (   t   has_datat
   isinstancet   sixt   string_typesRb  R$   R   t   broadcast_toR   R1   R   t   plotR   t   line_2d_to_3dt   juggle_axesR   (
   R   R~   R   RI   RJ   R   R   R  R   t   line(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR    s    

!!c   0   
   O` sb  |  j    } | j d k r* t d   n  t j | | |  \ } } } | j \ } } d | k pl d | k }	 d | k p d | k }
 |	 r |
 r t d   n  | j d d  } | j d d  } | j d d	  } | j d d	  } t d
 rD|
 rt t	 t j
 | |  d   } t t	 t j
 | |  d   } qnM |	 st t	 t j
 | |  d   } t t	 t j
 | |  d   } n  d | k r| j d  } nN | j d d  } | d k r|  j j   } n  t j t j |   } d } | j d d  } | j d d  } | j d d  } | j d d  } | j d d  } | j d | d k  } | j d d  } | r| d k	 r| d k	 r|  j | | |  } n  g  } | d k r4| r4t t j
 | d |  t j
 | d |   } t j | d f  } t j | d f  } d } n  g  } xt d | d |  D]} xt d | d |  D]} g  }  x!| | | f D]}! |! | | t | | | d   f }" |! | d t | | | d   t | d | |  f }# |! t | d | |  | t | | | d  d  f d d d  }$ |! | t | d | |  d  | f d d d  }% t j |" |# |$ |% f  }& |  j |&  qWt t |     }  t j g   }' |  d g g  t d t |    D]( }( |  |( |  |( d k r|  |( ^ q}) t d   |) D  }* | j |)  | d k	 rU| j | | |  n | j |* t |)   | d k rn| rnd t t |)  d  t d t |)  d  }+ }, }- t j |) |+  t j |) |,  | | <t j |) |,  t j |) |-  | | <| d 7} qnqnWqQW| d k rB| rBt j | |  }. n g  }. t j | | |  }/ | d k	 r| r|  j | |.  } n  |/ j  |  |/ j! |  n | rt j |  } |/ j" |  | d k	 s| d k	 r|/ j# | |  n  | d k	 r;|/ j$ |  q;n. | r(|  j | |.  } n | } |/ j  |  |  j% |/  |  j& | | | |  |/ S(   u  
        Create a surface plot.

        By default it will be colored in shades of a solid color, but it also
        supports color mapping by supplying the *cmap* argument.

        .. note::

           The *rcount* and *ccount* kwargs, which both default to 50,
           determine the maximum number of samples used in each direction.  If
           the input data is larger, it will be downsampled (by slicing) to
           these numbers of points.

        Parameters
        ----------
        X, Y, Z : 2d arrays
            Data values.

        rcount, ccount : int
            Maximum number of samples used in each direction.  If the input
            data is larger, it will be downsampled (by slicing) to these
            numbers of points.  Defaults to 50.

            .. versionadded:: 2.0

        rstride, cstride : int
            Downsampling stride in each direction.  These arguments are
            mutually exclusive with *rcount* and *ccount*.  If only one of
            *rstride* or *cstride* is set, the other defaults to 10.

            'classic' mode uses a default of ``rstride = cstride = 10`` instead
            of the new default of ``rcount = ccount = 50``.

        color : color-like
            Color of the surface patches.

        cmap : Colormap
            Colormap of the surface patches.

        facecolors : array-like of colors.
            Colors of each individual patch.

        norm : Normalize
            Normalization for the colormap.

        vmin, vmax : float
            Bounds for the normalization.

        shade : bool
            Whether to shade the face colors.

        **kwargs :
            Other arguments are forwarded to `.Poly3DCollection`.
        i   u!   Argument Z must be 2-dimensional.u   rstrideu   cstrideu   rcountu   ccountu.   Cannot specify both stride and count argumentsi
   i2   u   _internal.classic_modei   u
   facecolorsu   coloru   cmapu   normu   vminu   vmaxu	   linewidthu   shadeu   lightsourcei   i    Nic         s` s   |  ] } | d  Vq d S(   i   N(    (   t   .0t   p(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pys	   <genexpr>  s    ('   R  t   ndimR   R   t   broadcast_arrayst   shapeR$   R
   t   intt   maxt   ceilR"   t
   _get_linest   get_next_colorR   t   mcolorst   to_rgbat   gett   _shade_colors_lightsourcet   emptyR   Ru  t   concatenatet   appendRv   R   R   t   sumt   crossR   t   Poly3DCollectiont   _shade_colorst   set_facecolorst   set_edgecolorst	   set_arrayt   set_climt   set_normt   add_collectionR   (0   R   R   R   R   RI   RJ   R   t   rowst   colst
   has_stridet	   has_countt   rstridet   cstridet   rcountt   ccountt   fcolorst   colort   cmapt   normt   vmint   vmaxt	   linewidtht   shadet   lightsourcet   polyst   totptst   v1t   v2t   which_ptt   colsett   rst   cst   pst   at   ztopt   zleftt   zbaset   zrightRV   t   lastpR   t   ps2t   avgzsumt   i1t   i2t   i3t   normalst   polyc(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   plot_surface)  s    8
"("%	'!H7O8((c         C` s|   g  } xo | D]g } t  j | d  t  j | d  } t  j | d  t  j | d  } | j t  j | |   q W| S(   u   
        Generate normals for polygons by using the first three points.
        This normal of course might not make sense for polygons with
        more than three points not lying in a plane.
        i    i   i   (   R   R   R  R  (   R   t   polygonsR   t   vertsR  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   _generate_normals  s    $$c   	      C` s<  t  j g  | D]F } t j |  rJ t  j | t j |  d d d g  n t  j ^ q  } t  j |  } t | |  d k r#t t	 | |  t
 | |   } t	 | |  | | <t j |  } | d d  d f } d | |  d d  t  j f d | } | | d d  d f <n t  j |  j   } | S(   u   
        Shade *color* using normal vectors given by *normals*.
        *color* can also be an array of the same length as *normals*.
        ig      ?i    Ni   (   R   R   R   R9  R<  t   nant   isnanR   R   Ru  R  R  t   to_rgba_arrayt   newaxist
   asanyarrayt   copy(	   R   R  R   R  R  t   maskR  t   alphat   colors(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR    s    	S#+c         C` s4   | d  k r$ t d d d d  } n  | j | |  S(   Nt   azdegi   t   altdegi7   (   R"   R   R  (   R   t   dataR  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR  
  s    c          O` sS  |  j    } | j d k r* t d   n  t j | | |  \ } } } | j \ } } d | k pl d | k }	 d | k p d | k }
 |	 r |
 r t d   n  | j d d  } | j d d  } | j d d	  } | j d d	  } t d
 r\|
 r| r"t t	 t j
 | |  d   n d } | rPt t	 t j
 | |  d   n d } qne |	 s| rt t	 t j
 | |  d   n d } | rt t	 t j
 | |  d   n d } n  t j |  t j |  t j |  } } } | rEt t d | |   } | d k rK| d | d k rK| | d g 7} qKn g  } | rt t d | |   } | d k r| d | d k r| | d g 7} qn g  } | d k r| d k rt d   n  | j d k rg  } g  } n  g  | D] } | | ^ q} g  | D] } | | ^ q} g  | D] } | | ^ q,} g  | D] } | | ^ qI} g  | D] } | | ^ qf} g  | D] } | | ^ q} g  t | | |  D]' \ } } } t t | | |   ^ qg  t | | |  D]' \ } } } t t | | |   ^ q} t j | | |  } |  j |  |  j | | | |  | S(   u  
        Plot a 3D wireframe.

        .. note::

           The *rcount* and *ccount* kwargs, which both default to 50,
           determine the maximum number of samples used in each direction.  If
           the input data is larger, it will be downsampled (by slicing) to
           these numbers of points.

        Parameters
        ----------
        X, Y, Z : 2d arrays
            Data values.

        rcount, ccount : int
            Maximum number of samples used in each direction.  If the input
            data is larger, it will be downsampled (by slicing) to these
            numbers of points.  Setting a count to zero causes the data to be
            not sampled in the corresponding direction, producing a 3D line
            plot rather than a wireframe plot.  Defaults to 50.

            .. versionadded:: 2.0

        rstride, cstride : int
            Downsampling stride in each direction.  These arguments are
            mutually exclusive with *rcount* and *ccount*.  If only one of
            *rstride* or *cstride* is set, the other defaults to 1.  Setting a
            stride to zero causes the data to be not sampled in the
            corresponding direction, producing a 3D line plot rather than a
            wireframe plot.

            'classic' mode uses a default of ``rstride = cstride = 1`` instead
            of the new default of ``rcount = ccount = 50``.

        **kwargs :
            Other arguments are forwarded to `.Line3DCollection`.
        i   u!   Argument Z must be 2-dimensional.u   rstrideu   cstrideu   rcountu   ccountu.   Cannot specify both stride and count argumentsi   i2   u   _internal.classic_modei    iu*   Either rstride or cstride must be non zero(   R  R  R   R   R  R  R$   R
   R  R  R  t	   transposeRv   R   t   sizeR   R   t   Line3DCollectionR  R   (    R   R   R   R   RI   RJ   R   R  R  R  R  R  R  R  R  t   tXt   tYt   tZt   riit   ciiR   t   xlinest   ylinest   zlinest   txlinest   tylinest   tzlinest   xlt   ylt   zlR   t   linec(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   plot_wireframe  sd    (
.4.1/  	:>c         O` s.  |  j    } | j d d  } | d k r< |  j j   } n  t j t j |   } | j	 d d  } | j d d  } | j d d  } | j d d  } | j	 d d  }	 | j d | d k  }
 | j d d  } t
 j | |   \ } } } d	 | k rt j | j d	   } n t j | d
  } | d } | j   } | j | } | j | } | | } t j | d t j f | d t j f | d t j f f d d } t j | | |  } | rI| d d  d d  d f j d d  } | j |  | d k	 s| d k	 r*| j | |  n  | d k	 r| j |  qn |
 r| d d  d
 d d  f | d d  d d d  f } | d d  d d d  f | d d  d d d  f } t j | |  } |  j | |  } n | } | j |  |  j |  |  j | j | j | |  | S(   up  
        ============= ================================================
        Argument      Description
        ============= ================================================
        *X*, *Y*, *Z* Data values as 1D arrays
        *color*       Color of the surface patches
        *cmap*        A colormap for the surface patches.
        *norm*        An instance of Normalize to map values to colors
        *vmin*        Minimum value to map
        *vmax*        Maximum value to map
        *shade*       Whether to shade the facecolors
        ============= ================================================

        The (optional) triangulation can be specified in one of two ways;
        either::

          plot_trisurf(triangulation, ...)

        where triangulation is a :class:`~matplotlib.tri.Triangulation`
        object, or::

          plot_trisurf(X, Y, ...)
          plot_trisurf(X, Y, triangles, ...)
          plot_trisurf(X, Y, triangles=triangles, ...)

        in which case a Triangulation object will be created.  See
        :class:`~matplotlib.tri.Triangulation` for a explanation of
        these possibilities.

        The remaining arguments are::

          plot_trisurf(..., Z)

        where *Z* is the array of values to contour, one per point
        in the triangulation.

        Other arguments are passed on to
        :class:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`

        **Examples:**

        .. plot:: gallery/mplot3d/trisurf3d.py
        .. plot:: gallery/mplot3d/trisurf3d_2.py

        .. versionadded:: 1.2.0
            This plotting function was added for the v1.2.0 release.
        u   coloru   cmapu   normu   vminu   vmaxu	   linewidthu   shadeu   lightsourceu   Zi    i   .R   iNi   (   R  R$   R"   R  R  R   R   R  R  R  R   t   get_from_args_and_kwargsR   t   get_masked_trianglesRK   R   R  R	  R   R  t   meanR  R  R  R  R  R  R  R   (   R   RI   RJ   R   R  R  R  R  R  R  R  R  t   triRV   t	   trianglest   xtt   ytt   ztR  R  t   avg_zR  R  R   R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   plot_trisurf  sT    1

6	+<<i   c         C` s  | j  } | j } | d | d d } x>t | |  D]-\ } } t j | j   | |  } t j | j   | |  }	 | j   d }
 g  } g  } t j t	 | d  |  } | d k r t	 | d  d k r8 d } q q8 n  t	 | d  d | d } xt
 t t j |   d  D] } t t j | |   } t t j | d |   } | j | d | | d | |	 d | |	 d | g  t j | d |  t j | d |  } t j | d |  t j |	 d |  } | j t j | |   q"W|  j |
 |  } |  j |
 |  } t j | d | d | } | j |  |  j |  q8 Wx | D] } |  j j |  qpWd S(   u4   
        Extend a contour in 3D by creating
        i   i    i   t
   facecolorst
   edgecolorsN(   t   levelsR   R   R   t   paths_to_3d_segmentst	   get_pathst	   get_colorR   t   roundR   t   rangeR  R  R   R  R  R  t   set_sort_zpost   add_collection3dt   remove(   R   t   csett   strideR1  t   collsR  RV   R#  t   topvertst   botvertsR  t	   polyvertsR   t   nstepst   stepsizeR   R  R  R  R  R  t   colors2t   polycolR   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   _3d_extend_contour  sD    			&,,	u   zc         C` sx   d | } | r# |  j  | |  nQ xN t | j | j  D]7 \ } } | d  k	 rZ | } n  t j | | d | q9 Wd  S(   Nu   -R  (   RD  R   R1  R   R"   R   t   line_collection_2d_to_3d(   R   R:  t   extend3dR;  R  t   offsetRV   R#  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   add_contour_set#  s    
"	c         C` sl   d | } x[ t  | j | j  D]D \ } } | d  k	 rA | } n  t j | | d | | j |  q  Wd  S(   Nu   -R  (   R   R1  R   R"   R   t   poly_collection_2d_to_3dR7  (   R   R:  R  RG  RV   R#  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   add_contourf_set-  s    
"	c         O` s   | j  d t  } | j  d d  } | j  d d  } | j  d d  }	 |  j   }
 t j | | | |  \ } } } t t |   j | | | | |  } |  j	 | | | | |	  |  j
 | | | |
  | S(   uI  
        Create a 3D contour plot.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *X*, *Y*,   Data values as numpy.arrays
        *Z*
        *extend3d*  Whether to extend contour in 3D (default: False)
        *stride*    Stride (step size) for extending contour
        *zdir*      The direction to use: x, y or z (default)
        *offset*    If specified plot a projection of the contour
                    lines on this position in plane normal to zdir
        ==========  ================================================

        The positional and other keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.contour`

        Returns a :class:`~matplotlib.axes.Axes.contour`
        u   extend3du   stridei   u   zdiru   zu   offsetN(   R$   RO   R"   R  R   t   rotate_axesR1   R   t   contourRH  R   (   R   R   R   R   RI   RJ   RF  R;  R  RG  R   t   jXt   jYt   jZR:  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRL  5  s    !$c         O` sC  | j  d t  } | j  d d  } | j  d d  } | j  d d
  } |  j   } t j | |   \ } } } | j }	 | j }
 d | k r | j  d  } n | d } | d	 } t j	 |	 |
 | |  \ } } } t | | | j
 | j  } t t |   j | | | |  } |  j | | | | |  |  j |	 |
 | |  | S(   u  
        Create a 3D contour plot.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *X*, *Y*,   Data values as numpy.arrays
        *Z*
        *extend3d*  Whether to extend contour in 3D (default: False)
        *stride*    Stride (step size) for extending contour
        *zdir*      The direction to use: x, y or z (default)
        *offset*    If specified plot a projection of the contour
                    lines on this position in plane normal to zdir
        ==========  ================================================

        Other keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.tricontour`

        Returns a :class:`~matplotlib.axes.Axes.contour`

        .. versionchanged:: 1.3.0
            Added support for custom triangulations

        EXPERIMENTAL:  This method currently produces incorrect output due to a
        longstanding bug in 3D PolyCollection rendering.
        u   extend3du   stridei   u   zdiru   zu   offsetu   Zi    i   N(   R$   RO   R"   R  R   R%  RK   R   R   RK  R)  R  R1   R   t
   tricontourRH  R   (   R   RI   RJ   RF  R;  R  RG  R   R(  R   R   R   RM  RN  RO  R:  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRP  [  s&    		

!!c         O` s   | j  d d  } | j  d d  } |  j   } t j | | | |  \ }	 }
 } t t |   j |	 |
 | | |  } |  j | | |  |  j	 | | | |  | S(   u   
        Create a 3D contourf plot.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *X*, *Y*,   Data values as numpy.arrays
        *Z*
        *zdir*      The direction to use: x, y or z (default)
        *offset*    If specified plot a projection of the filled contour
                    on this position in plane normal to zdir
        ==========  ================================================

        The positional and keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.contourf`

        Returns a :class:`~matplotlib.axes.Axes.contourf`

        .. versionchanged :: 1.1.0
            The *zdir* and *offset* kwargs were added.
        u   zdiru   zu   offsetN(
   R$   R"   R  R   RK  R1   R   t   contourfRJ  R   (   R   R   R   R   RI   RJ   R  RG  R   RM  RN  RO  R:  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRQ    s    !$c         O` s  | j  d d  } | j  d d  } |  j   } t j | |   \ } } } | j } | j } d | k r{ | j  d  }	 n | d }	 | d } t j | | |	 |  \ }
 } } t |
 | | j	 | j
  } t t |   j | | | |  } |  j | | |  |  j | | |	 |  | S(   u  
        Create a 3D contourf plot.

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *X*, *Y*,   Data values as numpy.arrays
        *Z*
        *zdir*      The direction to use: x, y or z (default)
        *offset*    If specified plot a projection of the contour
                    lines on this position in plane normal to zdir
        ==========  ================================================

        Other keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.tricontour`

        Returns a :class:`~matplotlib.axes.Axes.contour`

        .. versionchanged :: 1.3.0
            Added support for custom triangulations

        EXPERIMENTAL:  This method currently produces incorrect output due to a
        longstanding bug in 3D PolyCollection rendering.
        u   zdiru   zu   offsetu   Zi    i   N(   R$   R"   R  R   R%  RK   R   R   RK  R)  R  R1   R   t   tricontourfRJ  R   (   R   RI   RJ   R  RG  R   R(  R   R   R   RM  RN  RO  R:  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRR    s"    		

!!i    c         C` s
  t  j |  } t |  d k r0 t |  } n d } t |  t j k rt t j | d | d | | j	 |  n| t |  t j
 k r t j | d | d | | j	 |  n> t |  t j k r t j | d | d | | j	 |  n  t t |   j |  d S(   u)  
        Add a 3D collection object to the plot.

        2D collection types are converted to a 3D version by
        modifying the object and adding z coordinate information.

        Supported are:
            - PolyCollection
            - LineCollection
            - PatchCollection
        i    R   R  N(   R   RT  R   Ru  t   typet   mcollt   PolyCollectionR   RI  R7  t   LineCollectionRE  t   PatchCollectiont   patch_collection_2d_to_3dR1   R   R  (   R   R   R   R  t   zvalst   zsortval(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR8    s    i   c      	   O` s\  |  j    }
 t j g  | | | g D]' } t j t j j | t j   ^ q"   \ } } } t j j |  } t j | | | | |  \ } } } } } t	 t
 |   j | | d | d | | |	 } t j |  } t j | t |   } t j | d | d | d | |  j d k  r9| j d k r9|  j d  n  | sX|  j | | | |
  n  | S(   u1  
        Create a scatter plot.

        ============  ========================================================
        Argument      Description
        ============  ========================================================
        *xs*, *ys*    Positions of data points.
        *zs*          Either an array of the same length as *xs* and
                      *ys* or a single value to place all points in
                      the same plane. Default is 0.
        *zdir*        Which direction to use as z ('x', 'y' or 'z')
                      when plotting a 2D set.
        *s*           Size in points^2.  It is a scalar or an array of the
                      same length as *x* and *y*.

        *c*           A color. *c* can be a single color format string, or a
                      sequence of color specifications of length *N*, or a
                      sequence of *N* numbers to be mapped to colors using the
                      *cmap* and *norm* specified via kwargs (see below). Note
                      that *c* should not be a single numeric RGB or RGBA
                      sequence because that is indistinguishable from an array
                      of values to be colormapped.  *c* can be a 2-D array in
                      which the rows are RGB or RGBA, however, including the
                      case of a single row to specify the same color for
                      all points.

        *depthshade*
                      Whether or not to shade the scatter markers to give
                      the appearance of depth. Default is *True*.
        ============  ========================================================

        Keyword arguments are passed on to
        :func:`~matplotlib.axes.Axes.scatter`.

        Returns a :class:`~mpl_toolkits.mplot3d.art3d.Patch3DCollection`
        R  t   cR   R  t
   depthshadeg?i    (   R  R   R  t   ravelt   mat   filledR  R   t   delete_masked_pointsR1   R   t   scatterR   R   R  R   R   RX  R   R  R   R   (   R   R~   R   R   R  R  R[  R\  RI   RJ   R   t   tR   t   is_2d(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRa  
	  s     'I*c         O` sO  |  j    } t t |   j | | | |  } t j | t |   } g  }	 g  }
 x t | |  D]u \ } } t j	 |  } |	 | j
   7}	 |
 | g t |  7}
 t j | | |  d | k ra | j | d  qa qa Wt |	  d k rt t |	    \ } } n g  g  } } t j | | |
 |  \ } } }
 |  j | | |
 |  | S(   u  
        Add 2D bar(s).

        ==========  ================================================
        Argument    Description
        ==========  ================================================
        *left*      The x coordinates of the left sides of the bars.
        *height*    The height of the bars.
        *zs*        Z coordinate of bars, if one value is specified
                    they will all be placed at the same z.
        *zdir*      Which direction to use as z ('x', 'y' or 'z')
                    when plotting a 2D set.
        ==========  ================================================

        Keyword arguments are passed onto :func:`~matplotlib.axes.Axes.bar`.

        Returns a :class:`~mpl_toolkits.mplot3d.art3d.Patch3DCollection`
        u   alphai    (   R  R1   R   t   barR   R  R   R   R   t   get_patch_vertsRU  t   patch_2d_to_3dt	   set_alphaRv   R  R   (   R   R  t   heightR   R  RI   RJ   R   R   R  t   verts_zsR  RV   t   vsR~   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRd  K	  s$    !!u   averagec
         O` s  |  j    } t j t j |  | | | | |  \ } } } } } } t j |  } t j | |  } t j |  } t j | |  } t j |  } t j | |  } g  } xt | | | | | |  D]\ } } } } } } | j | | | f | | | | f | | | | | f | | | | f f | | | | f | | | | | f | | | | | | f | | | | | f f | | | f | | | | f | | | | | f | | | | f f | | | | f | | | | | f | | | | | | f | | | | | f f | | | f | | | | f | | | | | f | | | | f f | | | | f | | | | | f | | | | | | f | | | | | f f g  q Wg  } | d k r|  j	 j
   g } n  t |  t |  k rxi | D] } | j | g d  qWnD t t j |   } t |  t |  k  rc| d t |  9} n  |	 r|  j |  } |  j | |  } n | } t j | d | d | |
 | } |  j |  |  j | | f | | f | | f |  | S(   u'  Generate a 3D barplot.

        This method creates three dimensional barplot where the width,
        depth, height, and color of the bars can all be uniquely set.

        Parameters
        ----------
        x, y, z : array-like
            The coordinates of the anchor point of the bars.

        dx, dy, dz : scalar or array-like
            The width, depth, and height of the bars, respectively.

        color : sequence of valid color specifications, optional
            The color of the bars can be specified globally or
            individually. This parameter can be:

              - A single color value, to color all bars the same color.
              - An array of colors of length N bars, to color each bar
                independently.
              - An array of colors of length 6, to color the faces of the
                bars similarly.
              - An array of colors of length 6 * N bars, to color each face
                independently.

            When coloring the faces of the boxes specifically, this is
            the order of the coloring:

              1. -Z (bottom of box)
              2. +Z (top of box)
              3. -Y
              4. +Y
              5. -X
              6. +X

        zsort : str, optional
            The z-axis sorting scheme passed onto
            :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`

        shade : bool, optional (default = True)
            When true, this shades the dark sides of the bars (relative
            to the plot's source of light).

        Any additional keyword arguments are passed onto
        :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`

        Returns
        -------
        collection : Poly3DCollection
            A collection of three dimensional polygons representing
            the bars.
        i   t   zsortt	   facecolorN(   R  R   R  RT  Ru  R  R   t   extendR"   t   _get_patches_for_fillR  R   Rv   R  R  R  R  R   R  R  R   (   R   RK   R   RV   R  R  R  R  Rk  R  RI   RJ   R   Rx   Ry   Rz   R{   R|   R}   R  t   xit   yit   zit   dxit   dyit   dziR/  R[  R   t   sfacecolorsR   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   bar3d|	  sX    734'$/'$/'$:(u   centerc         K` sT   t  t |   j | d | d | | } |  j j   \ } } |  j j d |  | S(   NR  t   locgq=
ףp?(   R1   R   t	   set_titlet   titlet   get_positiont   set_y(   R   R  R  Rw  RJ   t   retRK   R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyRx  	  s
    	c         O` su  d d  } |  j    } | j d d  } | j d d  } | j d d  } | j d	 t  } d
 }	 t |  |	 k  r t d |	 t |  f   n  | |	  }
 g  |
 D]* } t | t t f  r | g n | ^ q }
 g  |
 D]$ } t | t j	 j
  r | j ^ q } t j |
 |   } | |	  }
 | |	 } | r|t t j |  } g  |
 D]$ } t j	 j | d | j   ^ qO}
 n g  |
 D] } | j   ^ q}
 t d   |
 D  rt j g  | |	 |  } |  j |  | St d   |
 D  st  t d   |
 D  d k st  t j d | d d } | | } | d k rT| | 8} nB | d k rq| | d 8} n% | d k rt d t |    n  t j |
 d   } t j |
 d |	 ! j t  } t j t j | d d d  } | d k } | | } | r$| | | | j d  } n
 | | } t |  d k r| t j j  | |  j! d d  } t j g  | D] } | |  ^ qr } | d d  d d  f t j j  | |  } t |  d d f | _" | j! d d  } t# |  t# |  } n g  } t j | | |	 |  } |  j |  |  j$ | d d  d f | d d  d f | d d  d f |  | S(   u  
        Plot a 3D field of arrows.

        call signatures::

            quiver(X, Y, Z, U, V, W, **kwargs)

        Arguments:

            *X*, *Y*, *Z*:
                The x, y and z coordinates of the arrow locations (default is
                tail of arrow; see *pivot* kwarg)

            *U*, *V*, *W*:
                The x, y and z components of the arrow vectors

        The arguments could be array-like or scalars, so long as they
        they can be broadcast together. The arguments can also be
        masked arrays. If an element in any of argument is masked, then
        that corresponding quiver element will not be plotted.

        Keyword arguments:

            *length*: [1.0 | float]
                The length of each quiver, default to 1.0, the unit is
                the same with the axes

            *arrow_length_ratio*: [0.3 | float]
                The ratio of the arrow head with respect to the quiver,
                default to 0.3

            *pivot*: [ 'tail' | 'middle' | 'tip' ]
                The part of the arrow that is at the grid point; the arrow
                rotates about this point, hence the name *pivot*.
                Default is 'tail'

            *normalize*: bool
                When True, all of the arrows will be the same length. This
                defaults to False, where the arrows will be different lengths
                depending on the values of u,v,w.

        Any additional keyword arguments are delegated to
        :class:`~matplotlib.collections.LineCollection`

        i   c   
      S` sk  t  j j |  d   } | d k rB |  d | } |  d | } n d \ } } t j |  } t j |  } t j |  } t  j | | d d | | | d | | | g | | d | | | d d | | | g | | | | | g g  } | j   }	 |	 d d d d g d d d d g f |	 d d d d g d d d d g f <| j	 |   |	 j	 |   f S(   uu   
            To calculate the arrow head. uvw should be a unit vector.
            We normalize it here:
            i   i    i   (   i    i   (
   R   t   linalgR  t   matht   radiansR7  R8  R   R  R<  (
   t   uvwt   angleR  RK   R   t   raR[  R  t   Rpost   Rneg(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt
   calc_arrow%
  s    2-Ku   lengthi   u   arrow_length_ratiog333333?u   pivotu   tailu	   normalizei   u-   Wrong number of arguments. Expected %d got %dR  c         s` s!   |  ] } t  |  d  k Vq d S(   i    N(   R   (   R  t   v(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pys	   <genexpr>i
  s    c         s` s!   |  ] } t  | t j  Vq d  S(   N(   R  R   t   ndarray(   R  t   k(    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pys	   <genexpr>q
  s    c         S` s   h  |  ] } | j   q S(    (   R  (   R  R  (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pys	   <setcomp>s
  s   	 i    t   numi   u   middleg       @u   tipu   Invalid pivot argument: i   R   iN(   ii   (%   R  R$   RO   R   R   R  R  t   floatR   R^  t   MaskedArrayR  R  R   t
   logical_orR   t
   compressedR   t   anyR   R  R  t   allt   AssertionErrort   linspacet   strt   column_stackt   astypet   sqrtR  t   reshapet   multiplyt   outert   swapaxesR  Rv   R   (   R   RI   RJ   R  R   t   lengtht   arrow_length_ratiot   pivott	   normalizet   argit
   input_argsR  t   maskst   bcastR  R#  t   shaft_dtt   arrow_dtt   XYZt   UVWR  t   shaftst   dt	   head_dirst   headsR   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   quiver	  sp    .
41

1"
"

%(/Fc   ,      ` s  t  |  d k r d   } n	 d   } | | |   \ }  }  j d k r] t d   n  t j  j d t j } t | d    | d k r t j	    \ } } } n   f d   | D \ } } }  f d   }	 | j
 d	 d  }
 |
 d k r|  j j   }
 n  |	 |
 d	  }
 | j
 d
 d  } |	 | d
  } |  j | | |  t j d d d g d d d g d d d g d d d g g d t j } t t  } d   } x| d  D]} | j j |  \ } } } t j |  } t j |  } t j |  } | j | j  } x| D]} x| D]x} | j | | d g  } t |  }  | rz| | j | |  n  x t | d  | d  D] \ } } | j | | | g  } | j | | | g  } t |  } t |  }   | r |  r| | j | |  q | r |  r| |  j | |  qqW| j | | | d g  }! | j | | | g  }" t |!  }#  |# r.| |# j |" |  q.q.Wq!WqWi  }$ x/| j   D]!\ }% }& | d k r|& }' n g  }' x |& D] }( |( d d  d f |( d d  d f |( d d  d f f }) t j |( j  }* | |) |* d d  d f <| |) |* d d  d f <| |) |* d d  d f <|' j |*  qWt j |' d |
 |% d | |% | }+ |  j |+  |+ |$ |% <qW|$ S(   ua
  
        ax.voxels([x, y, z,] /, filled, **kwargs)

        Plot a set of filled voxels

        All voxels are plotted as 1x1x1 cubes on the axis, with filled[0,0,0]
        placed with its lower corner at the origin. Occluded faces are not
        plotted.

        Call signatures::

            voxels(filled, facecolors=fc, edgecolors=ec, **kwargs)
            voxels(x, y, z, filled, facecolors=fc, edgecolors=ec, **kwargs)

        .. versionadded:: 2.1

        Parameters
        ----------
        filled : 3D np.array of bool
            A 3d array of values, with truthy values indicating which voxels
            to fill

        x, y, z : 3D np.array, optional
            The coordinates of the corners of the voxels. This should broadcast
            to a shape one larger in every dimension than the shape of `filled`.
            These can be used to plot non-cubic voxels.

            If not specified, defaults to increasing integers along each axis,
            like those returned by :func:`~numpy.indices`.
            As indicated by the ``/`` in the function signature, these arguments
            can only be passed positionally.

        facecolors, edgecolors : array_like, optional
            The color to draw the faces and edges of the voxels. Can only be
            passed as keyword arguments.
            This parameter can be:

              - A single color value, to color all voxels the same color. This
                can be either a string, or a 1D rgb/rgba array
              - ``None``, the default, to use a single color for the faces, and
                the style default for the edges.
              - A 3D ndarray of color names, with each item the color for the
                corresponding voxel. The size must match the voxels.
              - A 4D ndarray of rgb/rgba data, with the components along the
                last axis.

        **kwargs
            Additional keyword arguments to pass onto
            :func:`~mpl_toolkits.mplot3d.art3d.Poly3DCollection`

        Returns
        -------
        faces : dict
            A dictionary indexed by coordinate, where ``faces[i,j,k]`` is a
            `Poly3DCollection` of the faces drawn for the voxel
            ``filled[i,j,k]``. If no faces were drawn for a given voxel, either
            because it was not asked to be drawn, or it is fully occluded, then
            ``(i,j,k) not in faces``.

        Examples
        --------
        .. plot:: gallery/mplot3d/voxels.py
        .. plot:: gallery/mplot3d/voxels_rgb.py
        .. plot:: gallery/mplot3d/voxels_torus.py
        .. plot:: gallery/mplot3d/voxels_numpy_logo.py
        i   c         [` s   |  | | f | | f S(   N(    (   t
   _Axes3D__xt
   _Axes3D__yt
   _Axes3D__zR_  RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   voxels
  s    c         [` s   d  |  | f S(   N(   R"   (   R_  RJ   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR  
  s    u%   Argument filled must be 3-dimensionalt   dtypei   c         3` s!   |  ] } t  j |    Vq d  S(   N(   R   R  (   R  R[  (   t   coord_shape(    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pys	   <genexpr>  s    c         ` s   t  j |   d k r5 t j |    j t  j |    St  j |   d k r t  j |   d    j k r~ t d j |    n  |  St d j |    d  S(	   Ni    i   i   i   u8   When multidimensional, {} must match the shape of filledu   Invalid {} argument(   i    i   (   i   i   (   R   R  R   R  R  R   t   format(   R  t   name(   R_  (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   _broadcast_color_arg  s    u
   facecolorsu
   edgecolorsi    c         s` sP   t  j |  d t  j } x1 t |   D]# } | Vt  j | d d d } q% Wd S(   u)    Generator of cyclic permutation matices R  i   R   i    N(   R   R   t   intpR6  t   roll(   R  t   matR   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   permutation_matrices)  s    iNi   R/  R0  (   R   R  R   R   R   R  R  R  R"   t   indicesR$   Rn  R  R   R   Rv   R   R<  t   arangeR  R   t   itemsR  R   R  R8  (,   R   RI   RJ   R  t   xyzR  RK   R   RV   R  R/  R0  t   squaret   voxel_facesR  t   permutet   pct   qct   rct   pindst   qindst   rindst
   square_rotR  t   qRz  t   i0t   r1t   r2R{  t   p2R  R  t   pkt   pk2t   ikR  t   coordt
   faces_indst   facest	   face_indst   indt   facet   poly(    (   R  R_  s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR  
  s    F			
$
$	?
	N({   t   __name__t
   __module__t   __doc__R  R   t   GrouperR/   R"   R2   R3   R4   RS   RW   RZ   R=   Rr   Rs   Rt   R   R   R   R   R   RO   R   R   R   R   R   R   R   R   R   R   R   R   Ru   R   R  Rb   R  Rc   R  R  R   t   maxesR	   R   R   R
  R   R  R  R  R  t	   docstringt   dedent_interpdR7   R  R  R"  R$  R&  R(  R+  R-  R.  R,   R'   R   R<   R^  R_  R`  Rf  RR  RS  Rp  R  RQ  R  R  R  R  R  R  Rc  R  R  R  R  R  R  R   R  t   text3Dt   text2DR  t   plot3DR  R  R  R  R$  R.  RD  RH  RJ  RL  t	   contour3DRP  RQ  t
   contourf3DRR  R8  Ra  t	   scatter3DRd  Rv  Rx  R  t   quiver3DR  (    (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyR   /   s  P				
						2											H	U	222												
			/$									"	8						?&	
	
	
		+					x	l0
	$	7	#	2!?1r	g?c         C` s   t  j d d |   } } t  j | |  \ } } t  j | d | d d  d t  j } t  j | d d d | d d d d  d t  j d d } | | } | d } | d } | d } | | | f S(	   u6   
    Return a tuple X, Y, Z with a test data set.
    g      g      @i   i   g      ?g      ?i
   i  (   R   R  t   meshgridt   expR5  (   R   RK   R   R   R   t   Z1t   Z2R   (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   get_test_dataw  s    +-



(8   R  t
   __future__R    R   R   R   R  t	   six.movesR   R   R   R   R~  R   R   R   t   numpyR   t   matplotlib.axesR   R  t   matplotlib.cbookR   t   matplotlib.collectionsRT  t   matplotlib.colorsR  R  t   matplotlib.docstringR  t   matplotlib.scalet   scaleR   t   matplotlib.transformst
   transformsR   R	   R
   R   R   R   R   t   matplotlib.tri.triangulationR   t    R   R   R   R   R   R  t   matplotlib.projectionst   projectionst   projt   projection_registryt   register(    (    (    s:   lib/python2.7/site-packages/mpl_toolkits/mplot3d/axes3d.pyt   <module>   sL   ""	           S