ó
 m[c           @` s  d  d l  m Z m Z m Z m Z d  d l Z d  d l j Z d  d l	 j
 Z
 d  d l j Z d  d l m Z d d l m Z m Z m Z m Z d d l m Z d „  Z d „  Z d	 e f d
 „  ƒ  YZ d e e f d „  ƒ  YZ d e f d „  ƒ  YZ d e f d „  ƒ  YZ e Z d S(   i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   SubplotSpeci   (   t   Sizet   SubplotDividert   LocatableAxest   Divider(   t   Colorbarc         C` s(   |  } t  | d ƒ s$ |  |  f } n  | S(   Nu   __getitem__(   t   hasattr(   t   valuet   ret(    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   _extend_axes_pad   s    c         C` sL   | } | } |  j  d j d | d | ƒ |  j  d j d | d | ƒ d  S(   Nu   bottomt
   ticklabelst   labelu   left(   t   axist   toggle(   t   axt	   bottom_ont   left_ont
   bottom_offt   left_off(    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt
   _tick_only   s    t   CbarAxesBasec           B` s#   e  Z d  „  Z d „  Z d „  Z RS(   c         ` s
  | j  d d  ƒ } | d  k rC d | k rC t j d ƒ | d <qC n  | d  k	 r{ d | k rn t d d ƒ ‚ q{ | | d <n  t |  _ |  j d k rœ d } n d	 } t |  | d
 | | ‰  |  j	 ƒ  ‡  f d †  } | j
 j d | ƒ |  _ ˆ  | _ ˆ  j j ƒ  |  _ ˆ  S(   Nu   locatoru   ticksi   u    Either *locator* or *ticks* needu    to be given, not bothu   topu   bottomu
   horizontalu   verticalt   orientationc         ` s7   ˆ  j  |  j ƒ  ƒ ˆ  j |  j ƒ  ƒ ˆ  j |  ƒ d  S(   N(   t   set_cmapt   get_cmapt   set_climt   get_climt   update_bruteforce(   t   m(   t   cb(    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt
   on_changed:   s    u   changed(   u   topu   bottom(   t   popt   Nonet   tickert   MaxNLocatort
   ValueErrort   Truet   _holdR   R	   t   _config_axest   callbacksSMt   connectt   cbidt   colorbart	   cbar_axist   get_major_locatort   locator(   t   selft   mappablet   kwargsR0   R   R!   (    (   R    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR-   $   s(    		
	c         C` sN   |  } | j  t ƒ | j j d t ƒ |  j } | j |  j j d | ƒ d S(   u1   
        Make an axes patch and outline.
        t   allN(   t   set_navigatet   FalseR   R   t   _default_label_onR   (   R1   R   t   b(    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR)   F   s
    	c         C` s3   | |  _  |  j |  j } | j d | d | ƒ d  S(   NR   R   (   R7   R   R   R   (   R1   R8   R   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   toggle_labeld   s    	(   t   __name__t
   __module__R-   R)   R9   (    (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR   "   s   	"	t   CbarAxesc           B` s   e  Z d  „  Z d „  Z RS(   c         O` se   | j  d d  ƒ } | d  k r- t d ƒ ‚ n  | |  _ t |  _ d  |  _ t t |  ƒ j	 | | Ž  d  S(   Nu   orientationu   orientation must be specified(
   R"   R#   R&   R   R'   R7   R0   t   superR   t   __init__(   R1   t   klR3   R   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR>   n   s    			c         C` s!   t  t |  ƒ j ƒ  |  j ƒ  d  S(   N(   R=   R   t   claR)   (   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR@   x   s    (   R:   R;   R>   R@   (    (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR<   m   s   	
t   Gridc        
   B` s¿   e  Z d  Z e Z d d d e e e e d d 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 d „  Z d „  Z d „  Z RS(   u  
    A class that creates a grid of Axes. In matplotlib, the axes
    location (and size) is specified in the normalized figure
    coordinates. This may not be ideal for images that needs to be
    displayed with a given aspect ratio.  For example, displaying
    images of a same size with some fixed padding between them cannot
    be easily done in matplotlib. AxesGrid is used in such case.
    u   rowg{®Gáz”?u   Lc      	   C` sL  | \ |  _  |  _ | d k r1 |  j  |  j } n1 | |  j  |  j k sS | d k rb t d ƒ ‚ n  | |  _ |  j | ƒ | d k r“ t d ƒ ‚ n  | |  _ | d k rº |  j } i  } n< t | ƒ t k rê t	 | |  j j
 ƒ rê i  } n | \ } } g  |  _ g  t |  j ƒ D] } g  ^ q|  _ g  t |  j  ƒ D] } g  ^ q4|  _ g  } g  } t | t j ƒ svt j | ƒ rt | | d | d | d t ƒ|  _ nÀ t | t ƒ rÓt | | d | d | d t ƒ|  _ nŠ t | ƒ d k rt d | d | d t ƒ } t | | | Ž |  _ nE t | ƒ d	 k rQt | | d | d | d t ƒ|  _ n t d ƒ ‚ |  j j ƒ  } g  t |  j ƒ D] } d ^ q||  _ g  t |  j  ƒ D] } d ^ q¡|  _ d |  _ x1t |  j ƒ D] } |  j | ƒ \ } } | r|  j } |  j } n8 |	 r|  j | } n d } |
 r7|  j | } n d } | | | d
 | d | | } | r|  j d k r·| |  _ q·n8 | d k r›| |  j | <n  | d k r·| |  j | <n  |  j j  | ƒ |  j | j  | ƒ |  j | j  | ƒ qÏW|  j d d |  _! |  j" ƒ  | r;x! |  j D] } | j# | ƒ q!Wn  |  j$ | ƒ d S(   u   
        Build an :class:`Grid` instance with a grid nrows*ncols
        :class:`~matplotlib.axes.Axes` in
        :class:`~matplotlib.figure.Figure` *fig* with
        *rect=[left, bottom, width, height]* (in
        :class:`~matplotlib.figure.Figure` coordinates) or
        the subplot position code (e.g., "121").

        Optional keyword arguments:

          ================  ========  =========================================
          Keyword           Default   Description
          ================  ========  =========================================
          direction         "row"     [ "row" | "column" ]
          axes_pad          0.02      float| pad between axes given in inches
                                      or tuple-like of floats,
                                      (horizontal padding, vertical padding)
          add_all           True      bool
          share_all         False     bool
          share_x           True      bool
          share_y           True      bool
          label_mode        "L"       [ "L" | "1" | "all" ]
          axes_class        None      a type object which must be a subclass
                                      of :class:`~matplotlib.axes.Axes`
          ================  ========  =========================================
        i    u    u   columnu   rowt
   horizontalt   verticalt   aspecti   i   t   sharext   shareyiÿÿÿÿN(   u   columnu   row(%   t   _nrowst   _ncolsR#   t	   Exceptiont   ngridst   _init_axes_padt
   _directiont   _defaultLocatableAxesClasst   typet
   issubclasst   Axest   axes_allt   ranget   axes_columnt   axes_rowt
   isinstancet   sixt   string_typest   cbookt
   is_numlikeR   R6   t   _dividerR   t   lent   dictR   t   get_positiont   _column_refaxt
   _row_refaxt   _refaxt   _get_col_rowt   appendt   axes_llct   _update_locatorst   add_axest   set_label_mode(   R1   t   figt   rectt   nrows_ncolsRJ   t	   directiont   axes_padt   add_allt	   share_allt   share_xt   share_yt
   label_modet
   axes_classt   axes_class_argst   _t   ht   vt   kwt   it   colt   rowRE   RF   R   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR>   ‰   sŠ    ("						%%!%%			
c         C` sE   t  | ƒ } | |  _ t j | d ƒ |  _ t j | d ƒ |  _ d  S(   Ni    i   (   R   t	   _axes_padR   t   Fixedt   _horiz_pad_sizet   _vert_pad_size(   R1   Rk   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRK     s    	c         C` sr  g  } g  } xY |  j  D]N } | r5 | j |  j ƒ n  | j t | ƒ ƒ t j d ƒ } | j | ƒ q Wg  } g  } xf |  j d  d  d … D]N } | rª | j |  j ƒ n  | j t | ƒ ƒ t j d ƒ } | j | ƒ q‹ Wxn t |  j	 ƒ D]] } |  j
 | ƒ \ } }	 |  j j d | | d | |  j d |	 ƒ }
 |  j | j |
 ƒ qí W|  j j | ƒ |  j j | ƒ d  S(   Ni   iÿÿÿÿt   nxt   ny(   R^   Rb   R|   R[   R   t   ScaledR_   R}   RR   RJ   Ra   RZ   t   new_locatorRG   RQ   t   set_axes_locatort   set_horizontalt   set_vertical(   R1   Rt   t   h_ax_posRs   t   szRu   t   v_ax_posRw   Rx   Ry   R0   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRd     s.    c         C` sL   |  j  d k r* t | |  j ƒ \ } } n t | |  j ƒ \ } } | | f S(   Nu   column(   RL   t   divmodRG   RH   (   R1   t   nRx   Ry   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRa   A  s    c         C` s   t  |  j ƒ S(   N(   R[   RQ   (   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   __len__J  s    c         C` s   |  j  | S(   N(   RQ   (   R1   Rw   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   __getitem__M  s    c         C` s   |  j  |  j f S(   u†   
        get geometry of the grid. Returns a tuple of two integer,
        representing number of rows and number of columns.
        (   RG   RH   (   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   get_geometryP  s    c         C` s-   | |  _  | d |  j _ | d |  j _ d S(   u   set axes_padi    i   N(   Rz   R|   t
   fixed_sizeR}   (   R1   Rk   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   set_axes_padW  s    	c         C` s   |  j  S(   u‹   
        get axes_pad

        Returns
        -------
        tuple
            Padding in inches, (horizontal pad, vertical pad)
        (   Rz   (   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   get_axes_pad_  s    	c         C` s   |  j  j | ƒ d S(   u
   set aspectN(   RZ   t
   set_aspect(   R1   RD   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR   j  s    c         C` s   |  j  j ƒ  S(   u
   get aspect(   RZ   t
   get_aspect(   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR‘   n  s    c         C` sZ  | d k r3 xG|  j  D] } t | t t ƒ q Wn#| d k rþ x/ |  j d d  D] } t | d t d t ƒqQ W|  j d d } t | d t d t ƒx» |  j d D]Q } x( | d  D] } t | d t d t ƒq· W| d } t | d t d t ƒq¦ WnX | d k rVx' |  j  D] } t | d t d t ƒqW|  j } t | d t d t ƒn  d	 S(
   u   set label_modeu   allu   Li    iÿÿÿÿR   R   i   u   1N(   RQ   R   R6   RS   R'   Rc   (   R1   t   modeR   Rx   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRf   r  s$    
	c         C` s   |  j  S(   N(   RZ   (   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   get_divider  s    c         C` s   |  j  j | ƒ d  S(   N(   RZ   t   set_locator(   R1   R0   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR‚   ’  s    c         C` s   |  j  j ƒ  S(   N(   RZ   t   get_locator(   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   get_axes_locator•  s    c         C` s   |  j  j ƒ  S(   N(   RZ   t   get_vsize_hsize(   R1   (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR—   ˜  s    N(   R:   R;   t   __doc__R   RM   R#   R'   R6   R>   RK   Rd   Ra   RŠ   R‹   RŒ   RŽ   R   R   R‘   Rf   R“   R‚   R–   R—   (    (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRA   }   s4   €		%													t	   ImageGridc           B` sM   e  Z d  Z e Z d d d e e e d d d d d e d d „ Z d „  Z	 RS(	   u‘  
    A class that creates a grid of Axes. In matplotlib, the axes
    location (and size) is specified in the normalized figure
    coordinates. This may not be ideal for images that needs to be
    displayed with a given aspect ratio.  For example, displaying
    images of a same size with some fixed padding between them cannot
    be easily done in matplotlib. ImageGrid is used in such case.
    u   rowg{®Gáz”?u   Lu   rightu   5%c      	   C` sÊ  | \ |  _  |  _ | d k r1 |  j  |  j } n/ d | k oR |  j  |  j k  n s` t ‚ n  | |  _ t | ƒ } | |  _ | |  _ | |  _ | d k rÈ | d k r¸ | d |  _	 qÑ | d |  _	 n	 | |  _	 | |  _
 |  j | ƒ | d k rt d ƒ ‚ n  | |  _ | d k r)|  j } i  } n' t | t j ƒ rDi  } n | \ } } g  |  _ g  t |  j ƒ D] } g  ^ qi|  _ g  t |  j  ƒ D] } g  ^ qŽ|  _ g  |  _ g  } g  } t | t j ƒ sÙt j | ƒ r t | | d | d	 | d
 |	 ƒ|  _ nÀ t | t ƒ r6t | | d | d	 | d
 |	 ƒ|  _ nŠ t | ƒ d k r{t d | d	 | d
 |	 ƒ } t | | | Ž |  _ nE t | ƒ d k r´t | | d | d	 | d
 |	 ƒ|  _ n t d ƒ ‚ |  j j  ƒ  } g  t |  j ƒ D] } d ^ qß|  _! g  t |  j  ƒ D] } d ^ q|  _" d |  _# x^t |  j ƒ D]M} |  j$ | ƒ \ } } | rˆ|  j ry|  j d } |  j d } q¢d } d } n |  j! | } |  j" | } | | | d | d | | } |  j j% | ƒ |  j | j% | ƒ |  j | j% | ƒ | r|  j# d k r| |  _# qn  | d k r8| |  j! | <n  | d k rT| |  j" | <n  |  j& | | d |  j ƒ} |  j j% | ƒ q2W|  j d d |  _' |  j( ƒ  | rÒx( |  j |  j D] } | j) | ƒ q¸Wn  | r¹|  j d k rxÌ |  j D] } |  j d | _* qñWq¹|  j d k r‡x– t+ |  j ƒ D]S \ } } |  j$ | ƒ \ } } |  j d k rp|  j | | _* q-|  j | | _* q-Wq¹x/ t, |  j |  j ƒ D] \ } } | | _* qWn  |  j- |
 ƒ d S(   uµ  
        Build an :class:`ImageGrid` instance with a grid nrows*ncols
        :class:`~matplotlib.axes.Axes` in
        :class:`~matplotlib.figure.Figure` *fig* with
        *rect=[left, bottom, width, height]* (in
        :class:`~matplotlib.figure.Figure` coordinates) or
        the subplot position code (e.g., "121").

        Optional keyword arguments:

          ================  ========  =========================================
          Keyword           Default   Description
          ================  ========  =========================================
          direction         "row"     [ "row" | "column" ]
          axes_pad          0.02      float| pad between axes given in inches
                                      or tuple-like of floats,
                                      (horizontal padding, vertical padding)
          add_all           True      bool
          share_all         False     bool
          aspect            True      bool
          label_mode        "L"       [ "L" | "1" | "all" ]
          cbar_mode         None      [ "each" | "single" | "edge" ]
          cbar_location     "right"   [ "left" | "right" | "bottom" | "top" ]
          cbar_pad          None
          cbar_size         "5%"
          cbar_set_cax      True      bool
          axes_class        None      a type object which must be a subclass
                                      of axes_grid's subclass of
                                      :class:`~matplotlib.axes.Axes`
          ================  ========  =========================================

        *cbar_set_cax* : if True, each axes in the grid has a cax
          attribute that is bind to associated cbar_axes.
        i    u   leftu   righti   u   columnu   rowu    RB   RC   RD   i   i   RE   RF   R   iÿÿÿÿu   singleu   edgeN(   u   leftu   right(   u   columnu   row(   u   leftu   right(.   RG   RH   R#   RI   RJ   R   Rz   t   _colorbar_modet   _colorbar_locationt   _colorbar_padt   _colorbar_sizeRK   RL   RM   RU   t   maxesRP   RQ   RR   RS   RT   t	   cbar_axesRV   RW   RX   RY   R   RZ   R   R[   R\   R   R]   R^   R_   R`   Ra   Rb   t   _defaultCbarAxesClassRc   Rd   Re   t   caxt	   enumeratet   zipRf   (   R1   Rg   Rh   Ri   RJ   Rj   Rk   Rl   Rm   RD   Rp   t	   cbar_modet   cbar_locationt   cbar_padt	   cbar_sizet   cbar_set_caxRq   Rr   Rs   Rt   Ru   Rv   Rw   Rx   Ry   RE   RF   R   R¡   t   index(    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR>   ¯  s¸    3&												%%	!%%				
"c         C` sN
  g  } g  } g  } g  } |  j  d k r§|  j d k r§|  j d k rÂ t j |  j t j |  j ƒ ƒ } | j t j |  j	 | ƒ ƒ | j t j |  j
 | ƒ ƒ |  j j d d d d d d ƒ } nŒ |  j d k rNt j |  j t j |  j ƒ ƒ } | j t j |  j	 | ƒ ƒ | j t j |  j
 | ƒ ƒ |  j j d d d	 d d d ƒ } n  x+ t |  j ƒ D] } |  j | j t ƒ q^W|  j d j | ƒ |  j d j t ƒ n  xÃt |  j d ƒ D]®\ } }	 | rà| j |  j ƒ n  |	 rt j |	 d
 d d |  j d ƒ} n) t j |  j d d
 d d |  j d ƒ} |  j  d k s^|  j  d k r»| d k r»|  j d k r»| j t | ƒ ƒ | j t j |  j	 | ƒ ƒ | j t j |  j
 | ƒ ƒ n  | j t | ƒ ƒ | j | ƒ |  j  d k s|  j  d k r»| |  j d k r»|  j d k r»| j t j |  j
 | ƒ ƒ | j t | ƒ ƒ | j t j |  j	 | ƒ ƒ q»q»Wg  }
 g  } xÐt |  j d d  d  d … ƒ D]®\ } }	 | r¿| j |  j ƒ n  |	 rêt j |	 d
 d d |  j d ƒ} n) t j |  j d d
 d d |  j d ƒ} |  j  d k s=|  j  d k rš| d k rš|  j d k rš| j t | ƒ ƒ | j t j |  j	 | ƒ ƒ | j t j |  j
 | ƒ ƒ n  |
 j t | ƒ ƒ | j | ƒ |  j  d k së|  j  d k rš| |  j d k rš|  j d k rš| j t j |  j
 | ƒ ƒ | j t | ƒ ƒ | j t j |  j	 | ƒ ƒ qšqšWxt |  j ƒ D]} |  j | ƒ \ } } |  j j d | | d |
 |  j d | ƒ } |  j | j | ƒ |  j  d k r_|  j d k r|  j j d | | d |
 |  j d | ƒ } n@ |  j d k rH|  j j d | | d | |  j d | ƒ } n  |  j | j | ƒ q\|  j  d k r\|  j d k r‰| d k s«|  j d k rð| |  j d k rð|  j j d | d d |
 |  j d | ƒ } |  j | j | ƒ qj|  j d k r| |  j d k s-|  j d k rj| d k rj|  j j d | | d | d ƒ } |  j | j | ƒ qjq\q\W|  j  d k r 	|  j d k r	t j |  j t j |  j ƒ ƒ } | j t j |  j
 | ƒ ƒ | j t j |  j	 | ƒ ƒ |  j j d d d d d d ƒ } nŒ |  j d k r•t j |  j t j |  j ƒ ƒ } | j t j |  j
 | ƒ ƒ | j t j |  j	 | ƒ ƒ |  j j d d d	 d d d ƒ } n  |  j d k r*
x+ t |  j ƒ D] } |  j | j t ƒ q´W|  j d j | ƒ |  j d j t ƒ q*
n*|  j  d k r@	xt |  j ƒ D] } |  j | j t ƒ q	Wnê |  j  d k rÖ	|  j d k rj	|  j } n	 |  j } x( t | ƒ D] } |  j | j t ƒ q€	Wx‰ t | d |  j ƒ D] } |  j | j t ƒ qµ	WnT xQ t |  j ƒ D]@ } |  j | j t ƒ |  j | j d d d d g d d ƒqæ	W|  j j | ƒ |  j j  | ƒ d  S(   Nu   singleu   leftu   bottomR~   i    R   t   ny1iÿÿÿÿt   nx1RD   u   axest   ref_axu   eachu   edgei   u   rightu   topiþÿÿÿg      ð?gü©ñÒMbP?t   whichu   active(   u   leftu   bottom(   u   rightu   left(   u   topu   bottom(   u   rightu   top(   u   rightu   left(!   Rš   R›   R   t   FractionRG   t   AxesXRc   Rb   t   from_anyR   Rœ   RZ   R   RH   t   AxesYRR   RJ   RŸ   t   set_visibleR6   R‚   R'   R¢   RT   R|   RQ   R[   RS   R}   Ra   t   set_positionRƒ   R„   (   R1   Rt   Ru   R…   t   h_cb_posR†   R0   Rw   Rx   R   R‡   t   v_cb_posRy   t   countt   j(    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyRd   e  sú    !$!$ %#-%#%%"!$!$	N(
   R:   R;   R˜   R<   R    R#   R'   R6   R>   Rd   (    (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyR™   £  s    §(   t
   __future__R    R   R   R   RV   t   matplotlib.axest   axesRž   t   matplotlib.cbookRX   t   matplotlib.tickerR$   t   matplotlib.gridspecR   t   axes_dividerR   R   R   R   R-   R	   R   R   t   objectR   R<   RA   R™   t   AxesGrid(    (    (    s@   lib/python2.7/site-packages/mpl_toolkits/axes_grid1/axes_grid.pyt   <module>   s    ""		Kÿ 'ÿ `