ó
±éRc           @  sÚ   d  d l  m Z m Z d  d l Z e j Z d  d l j Z d  d l m Z d  d l m	 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 Z d  d l Z d e j f d „  ƒ  YZ d S(   iÿÿÿÿ(   t   divisiont   print_functionN(   t   allow_rasterization(   t	   docstringt   Spinec           B  s  e  Z d  Z d „  Z e j d „  ƒ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z e d „  ƒ Z e d „  ƒ Z d „  Z RS(   s“  an axis spine -- the line noting the data area boundaries

    Spines are the lines connecting the axis tick marks and noting the
    boundaries of the data area. They can be placed at arbitrary
    positions. See function:`~matplotlib.spines.Spine.set_position`
    for more information.

    The default position is ``('outward',0)``.

    Spines are subclasses of class:`~matplotlib.patches.Patch`, and
    inherit much of their behavior.

    Spines draw a line or a circle, depending if
    function:`~matplotlib.spines.Spine.set_patch_line` or
    function:`~matplotlib.spines.Spine.set_patch_circle` has been
    called. Line-like is the default.

    c         C  s   d S(   NR   (    (   t   self(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   __str__%   s    c         K  sî   t  t |  ƒ j | �  | |  _ |  j |  j j ƒ | |  _ |  j d ƒ |  j t	 d ƒ |  j
 t	 d ƒ d |  _ |  j d ƒ |  j |  j j ƒ d |  _ t |  _ d |  _ t | t j j ƒ sÉ t ‚ | |  _ d |  _ t j ƒ  |  _ d S(   sè   
        - *axes* : the Axes instance containing the spine
        - *spine_type* : a string specifying the spine type
        - *path* : the path instance used to draw the spine

        Valid kwargs are:
        %(Patch)s
        t   nones   axes.edgecolors   axes.linewidthg      @t   lineN(   t   superR   t   __init__t   axest
   set_figuret   figuret
   spine_typet   set_facecolort   set_edgecolort   rcParamst   set_linewidtht   Nonet   axist
   set_zordert   set_transformt	   transDatat   _boundst   Falset   _smart_boundst	   _positiont
   isinstancet
   matplotlibt   patht   Patht   AssertionErrort   _patht   _patch_typet   mtransformst   IdentityTransformt   _patch_transform(   R   R   R   R   t   kwargs(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyR
   (   s"    
								c         C  sW   | |  _  |  j d k r. |  j j j | ƒ n% |  j d k rS |  j j j | ƒ n  d S(   s6   set the spine and associated axis to have smart boundst   leftt   rightt   topt   bottomN(   s   lefts   right(   s   topR*   (   R   R   R   t   yaxist   set_smart_boundst   xaxis(   R   t   value(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyR,   S   s
    	c         C  s   |  j  S(   s&   get whether the spine has smart bounds(   R   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   get_smart_bounds]   s    c         C  sL   d |  _  | |  _ | d |  _ | d |  _ d |  _ |  j |  j j ƒ d S(   s   set the spine to be circulart   circlei   i    N(   R"   t   _centert   _widtht   _heightt   _angleR   R   t	   transAxes(   R   t   centert   radius(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   set_patch_circlea   s    			c         C  s   d |  _  d S(   s   set the spine to be linearR   N(   R"   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   set_patch_linek   s    c         C  s¡   |  j  d k s t ‚ |  j |  j d ƒ |  j |  j d ƒ f } |  j |  j ƒ } |  j |  j ƒ } t j ƒ  j	 | d | d ƒ j
 |  j ƒ j | Œ  |  _ d S(   s  NOTE: This cannot be called until after this has been added
                 to an Axes, otherwise unit conversion will fail. This
                 maxes it very important to call the accessor method and
                 not directly access the transformation member variable.
        R0   i    i   g      à?N(   R"   R    t   convert_xunitsR1   t   convert_yunitsR2   R3   R#   t   Affine2Dt   scalet
   rotate_degR4   t	   translateR%   (   R   R6   t   widtht   height(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   _recompute_transformp   s    c         C  s7   |  j  d k r  |  j ƒ  |  j St t |  ƒ j ƒ  Sd  S(   NR0   (   R"   RB   R%   R	   R   t   get_patch_transform(   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyRC   €   s    
c         C  s   |  j  S(   N(   R!   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   get_path‡   s    c         C  s/   |  j  d  k r+ d |  _  |  j |  j  ƒ n  d  S(   Nt   outwardg        (   RE   g        (   R   R   t   set_position(   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   _ensure_position_is_setŠ   s    	c         C  s,   | |  _  |  j  d k	 r( |  j  j ƒ  n  d S(   sÄ   register an axis

        An axis should be registered with its corresponding spine from
        the Axes instance. This allows the spine to clear any axis
        properties when needed.
        N(   R   R   t   cla(   R   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   register_axis�   s    	c         C  s,   d |  _ |  j d k	 r( |  j j ƒ  n  d S(   s   Clear the current spineN(   R   R   R   RH   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyRH   ›   s    	c         C  s�   |  j  ƒ  |  j } t j | ƒ rO | d k r7 d } qO | d k rO d } qO n  t | ƒ d k sm t d ƒ ‚ | \ } } | d	 k r• | d k r• t St Sd
 S(   s¶   return True if directly on axes frame

        This is useful for determining if a spine is the edge of an
        old style MPL plot. If so, this function will return True.
        R6   R   g      à?t   zerot   datai    i   s   position should be 2-tupleRE   N(   s   axesg      à?(   s   datai    (   RG   R   t   cbookt   is_string_liket   lenR    t   TrueR   (   R   t   positiont   position_typet   amount(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   is_frame_like¡   s    
		c         C  sÌ  |  j  d k r d S|  j d k r3|  j  d k rI |  j j j \ } } n: |  j  d k rp |  j j j \ } } n t d |  j  ƒ ‚ |  j rB| | k r¨ | | } } n  | } | } ~ ~ |  j  d k rð |  j j	 j \ } } |  j j
 ƒ  } n6 |  j  d k r&|  j j	 j \ } } |  j j ƒ  } n  t | ƒ } | j ƒ  t j | ƒ } | | k rg| | } } n  | | k  r|| } nN | | k | | k @} | | }	 t |	 ƒ rµ|	 d } n | } t | | ƒ } | | k rß| } q0| | k | | k @} | | }	 t |	 ƒ r|	 d	 } n | } t | | ƒ } qBn |  j \ } } |  j j }
 |
 j d k sit d ƒ ‚ |  j  d k r�| |
 d <| |
 d <n9 |  j  d k rµ| |
 d <| |
 d <n t d |  j  ƒ ‚ d S(   s3   automatically set spine bounds to the view intervalR0   NR'   R(   R)   R*   s   unknown spine spine_type: %siÿÿÿÿi    i   s   unexpected vertices shapei   s#   unable to set bounds for spine "%s"(   s   lefts   right(   s   tops   bottom(   s   lefts   right(   s   tops   bottom(   i   i   (   s   lefts   right(   i    i   (   i   i   (   s   bottoms   top(   i    i    (   i   i    (   R   R   R   R   t   viewLimt	   intervalyt	   intervalxt
   ValueErrorR   t   dataLimt
   get_ytickst
   get_xtickst   listt   sortt   npt   arrayRN   t   maxt   minR!   t   verticest   shapeR    (   R   t   lowt   hight   viewlim_lowt   viewlim_hight   datalim_lowt   datalim_hight   tickst   condt   tickvalst   v1(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   _adjust_locationµ   sj    	
	
	


c         C  s    |  j  ƒ  t t |  ƒ j | ƒ S(   N(   Rm   R	   R   t   draw(   R   t   renderer(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyRn   
  s    
c         C  sØ  |  j  ƒ  |  j } t j | ƒ rO | d k r7 d } qO | d k rO d } qO n  t | ƒ d k sm t d ƒ ‚ | \ } } | d k s‹ t ‚ | d	 k rj| d k r» d
 t j ƒ  f |  _ qÔ|  j	 d k r>i d d 6d d 6d d 6d d 6|  j	 } | | d d } | | d d } d t j
 | | |  j j ƒ f |  _ qÔt j d |  j	 ƒ d
 t j ƒ  f |  _ nj| d k r|  j	 d k r²d t j j d d d d | d ƒ f |  _ qÔ|  j	 d k rîd t j j d d d d d | ƒ f |  _ qÔt j d |  j	 ƒ d
 t j ƒ  f |  _ nº | d k rÔ|  j	 d  k rB| d 8} n  |  j	 d! k rud t j ƒ  j | d ƒ f |  _ qÔ|  j	 d" k r¨d t j ƒ  j d | ƒ f |  _ qÔt j d |  j	 ƒ d
 t j ƒ  f |  _ n  d S(#   s5   calculate the offset transform performed by the spineR6   R   g      à?RJ   RK   i    i   s   position should be 2-tupleRE   t   identityR'   R(   R)   R*   iÿÿÿÿi   g      R@t   posts2   unknown spine type "%s": no spine offset performedt   preN(   s   axesg      à?(   s   datai    (   s   axess   outwards   data(   s   lefts   rights   tops   bottom(   iÿÿÿÿi    (   i   i    (   i    iÿÿÿÿ(   i    i   (   s   lefts   right(   s   bottoms   top(   s   rights   top(   s   lefts   right(   s   bottoms   top(   RG   R   RL   RM   RN   R    R#   R$   t   _spine_transformR   t   ScaledTranslationR   t   dpi_scale_transt   warningst   warnR<   t   from_valuesR?   (   R   RP   RQ   RR   t
   offset_vect   offset_xt   offset_y(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   _calc_offset_transform  sv    
		

		!	!		c         C  sæ   | d k r n4 t  | ƒ d k s- t d ƒ ‚ | d d k sC t ‚ | |  _ |  j ƒ  |  j ƒ  } |  j d k rŒ t j | |  j j	 ƒ } n* |  j d k r¶ t j |  j j	 | ƒ } n  |  j
 | ƒ |  j d k	 râ |  j j ƒ  n  d S(   sp  set the position of the spine

        Spine position is specified by a 2 tuple of (position type,
        amount). The position types are:

        * 'outward' : place the spine out from the data area by the
          specified number of points. (Negative values specify placing the
          spine inward.)

        * 'axes' : place the spine at the specified Axes coordinate (from
          0.0-1.0).

        * 'data' : place the spine at the specified data coordinate.

        Additionally, shorthand notations define a special positions:

        * 'center' -> ('axes',0.5)
        * 'zero' -> ('data', 0.0)

        R6   RJ   i   s&   position should be 'center' or 2-tuplei    RE   R   RK   R'   R(   R*   R)   N(   s   centers   zero(   s   outwards   axess   data(   s   lefts   right(   s   bottoms   top(   RN   R    R   R|   t   get_spine_transformR   R#   t   blended_transform_factoryR   R   R   R   R   RH   (   R   RP   t   tt   t2(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyRF   Y  s     	
	c         C  s   |  j  ƒ  |  j S(   s   get the spine position(   RG   R   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   get_positionƒ  s    
c         C  sa  |  j  ƒ  |  j \ } } | d k r´ |  j j | |  j j |  j j } |  j d k rs t j | |  j j	 ƒ } n= |  j d k r� t j |  j j	 | ƒ } n t
 d |  j ƒ ‚ | S|  j d k rÛ |  j j d d ƒ } n: |  j d k r|  j j d d ƒ } n t
 d |  j ƒ ‚ | d	 k r%| S| d
 k r9| | S| d k rM| | St
 d | ƒ ‚ d S(   s   get the spine transformRK   R'   R(   R)   R*   s   unknown spine spine_type: %st   whicht   gridRp   Rq   Rr   s    unknown spine_transform type: %sN(   s   lefts   right(   s   tops   bottom(   s   lefts   right(   s   tops   bottom(   RG   Rs   R   t
   transScalet   transLimitsR5   R   R#   R~   R   RW   t   get_yaxis_transformt   get_xaxis_transform(   R   t   whatt   howt
   data_xformt   resultt   base_transform(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyR}   ˆ  s6    
	c         C  s1   |  j  d k r t d ƒ ‚ n  | | f |  _ d S(   s   Set the bounds of the spine.R0   s5   set_bounds() method incompatible with circular spinesN(   R   RW   R   (   R   Rc   Rd   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt
   set_bounds­  s    c         C  s   |  j  S(   s   Get the bounds of the spine.(   R   (   R   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt
   get_bounds´  s    c         K  s¹   | d k r$ t  j d	 d
 g ƒ } n| | d k rH t  j d d g ƒ } nX | d k rl t  j d d g ƒ } n4 | d k r� t  j d d g ƒ } n t d | ƒ ‚ |  | | | | � } | S(   sA   
        (staticmethod) Returns a linear :class:`Spine`.
        R'   g        i   R(   g      ð?R*   R)   s"   unable to make path for spine "%s"(   g        i   (   g        i   (   g      ð?i   (   g      ð?i   (   i   g        (   i   g        (   i   g      ð?(   i   g      ð?(   t   mpathR   RW   (   t   clsR   R   R&   R   R‹   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   linear_spine¸  s    c         K  s>   t  j j ƒ  } d } |  | | | | � } | j | | ƒ | S(   sC   
        (staticmethod) Returns a circular :class:`Spine`.
        R0   (   R�   R   t   unit_circleR8   (   R�   R   R6   R7   R&   R   R   R‹   (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   circular_spineË  s
    c         C  s   |  j  | ƒ d S(   sö   
        Set the edgecolor.

        ACCEPTS: matplotlib color arg or sequence of rgba tuples

        .. seealso::

            :meth:`set_facecolor`, :meth:`set_edgecolor`
               For setting the edge or face color individually.
        N(   R   (   R   t   c(    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt	   set_colorÖ  s    (   t   __name__t
   __module__t   __doc__R   R   t   dedent_interpdR
   R,   R/   R8   R9   RB   RC   RD   RG   RI   RH   RS   Rm   R   Rn   R|   RF   R�   R}   R�   RŽ   t   classmethodR‘   R“   R•   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyR      s2   	+	
		
									U	J	*		%		(   t
   __future__R    R   R   R   t   matplotlib.artistt   artistt   martistR   R   t   matplotlib.transformst
   transformsR#   t   matplotlib.linest   linest   mlinest   matplotlib.patchest   patchest   mpatchest   matplotlib.pathR   R�   t   matplotlib.cbookRL   t   numpyR]   Rv   t   PatchR   (    (    (    sK   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/spines.pyt   <module>   s   	