
 m[c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z d d l Z d d l	 Z	 d d l
 Z d d l Z d d l Z e	 j e  Z d   Z d e f d     YZ d d d  Z d d d	  Z d d d
  Z d d d  Z e d d  Z e d d  Z d e d  Z d e d  Z d d  Z d d  Z d d  Z d d  Z  d d  Z! d d  Z" d d  Z# d d  Z$ e j%   a& d   Z' d   Z( d   Z) d   Z* d   Z+ d e, d  Z- d S(    uX  

Conventions:

"constrain_x" means to constrain the variable with either
another kiwisolver variable, or a float.  i.e. `constrain_width(0.2)`
will set a constraint that the width has to be 0.2 and this constraint is
permanent - i.e. it will not be removed if it becomes obsolete.

"edit_x" means to set x to a value (just a float), and that this value can
change.  So `edit_width(0.2)` will set width to be 0.2, but `edit_width(0.3)`
will allow it to change to 0.3 later.  Note that these values are still just
"suggestions" in `kiwisolver` parlance, and could be over-ridden by
other constrains.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsNc         C` s{   |  j  r |  j  } nb |  j } | rB t | d  rB | j   } n5 t j d  d d l m } | |   } | j   } | S(   Nu   get_rendereru1   constrained_layout : falling back to Agg rendereri    (   t   FigureCanvasAgg(   t   _cachedRenderert   canvast   hasattrt   get_renderert   _logt   infot   matplotlib.backends.backend_aggR   (   t   figt   rendererR   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR   "   s    		t	   LayoutBoxc           B` s  e  Z d  Z d) d e e d) d* d+ e e d) d) d  Z d   Z d   Z d   Z d   Z	 d	   Z
 d
   Z d   Z d   Z d d  Z d d  Z d d  Z d   Z d d  Z d   Z d d  Z d   Z d d  Z d   Z d   Z d   Z d d  Z d d  Z d d  Z d d  Z d d  Z d d  Z d d   Z  d d!  Z! d d"  Z" d d#  Z# d$   Z$ d%   Z% d&   Z& d d) e d'  Z' d(   Z( RS(,   uD   
    Basic rectangle representation using kiwi solver variables
    u    i    i   c         C` s  t  j } | |  _ | |  _ |  j d } | d  k rO t  j   |  _ d |  _ n" | j |  _ d  |  _ | j |   | |  _	 | |  _
 |	 |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d	   |  _ | t | d
   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _ | t | d   |  _  | \ } } | \ } } | |  _! | |  _" |  j#   g  |  _$ d  |  _% |  j
 r|  j&   n  |
 |  _' | |  _( d  S(   Nu   _i    u   topu   bottomu   leftu   rightu   widthu   heightu   h_centeru   v_centeru	   min_widthu
   min_heightu
   pref_widthu   pref_heightu   left_marginu   right_marginu   bottom_marginu
   top_marginu   left_margin_minu   right_margin_minu   bottom_margin_minu   top_margin_min()   t   kiwit   Variablet   parentt   namet   Nonet   Solvert   solvert   constrained_layout_calledt	   add_childt   artistt   post   subplott   strt   topt   bottomt   leftt   rightt   widtht   heightt   h_centert   v_centert	   min_widtht
   min_heightt
   pref_widtht   pref_heightt   left_margint   right_margint   bottom_margint
   top_margint   left_margin_mint   right_margin_mint   bottom_margin_mint   top_margin_mint   tightheightt
   tightwidtht   add_constraintst   childrent   subplotspect   constrain_marginst   h_padt   w_pad(   t   selfR   R   R1   R0   R   t
   lower_leftt   upper_rightR   R   R6   R7   R   t   snR   R   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   __init__9   sX    									
				c         C` sQ  |  j  } | j |  j  sD | j |  j d  | j |  j d  n  |  j |  j |  j j k } |  j  j | d B |  j |  j k } |  j  j | d B | j |  j	  s | j |  j	 d  | j |  j	 d  n  |  j
 |  j j |  j k } |  j  j | d B |  j
 |  j	 k } |  j  j | d B | j |  j  sf| j |  j d  | j |  j d  n  |  j |  j |  j j k } |  j  j | d B |  j |  j k } |  j  j | d B | j |  j  s| j |  j d  | j |  j d  n  |  j |  j j |  j k } |  j  j | d B |  j |  j k } |  j  j | d B d S(   u  
        Only do this for pos.  This sets a variable distance
        margin between the position of the axes and the outer edge of
        the axes.

        Margins are variable because they change with the fogure size.

        Margin minimums are set to make room for axes decorations.  However,
        the margins can be larger if we are mathicng the position size to
        otehr axes.
        u   strongg-C6?u   requiredN(   R   t   hasEditVariableR,   t   addEditVariablet   suggestValueR(   R   R   t   addConstraintR-   R)   R   R.   R*   R   R/   R+   R   (   R8   t   solt   c(    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR5   x   s:    	c         C` s   |  j  | g 7_  d  S(   N(   R3   (   R8   t   child(    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR      s    c         C` s9   y |  j  j |  Wn t k
 r4 t j d  n Xd  S(   Nu3   Tried to remove child that doesn't belong to parent(   R3   t   removet
   ValueErrorR	   R
   (   R8   RC   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   remove_child   s    c         C` sj   |  j  } x: |  j |  j g D]& } | j | d  | j | d  q W|  j   |  j rf |  j   n  d  S(   Ng    eAg        (   R   R$   R%   R>   R?   t   hard_constraintsR   t   parent_constrain(   R8   RA   t   i(    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR2      s    	
	c         C` st   |  j  } |  j | j k |  j | j k |  j | j k |  j | j k g } x" | D] } |  j j | d B qR Wd  S(   Nu   required(   R   R   R   R   R   R   R@   (   R8   R   t   hcRB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyRH      s    	c         C` s   |  j  |  j |  j k |  j |  j |  j k |  j |  j |  j d k |  j |  j |  j d k |  j  |  j k |  j |  j	 k g } x" | D] } |  j
 j | d B q Wd  S(   Ng      ?u   required(   R    R   R   R!   R   R   R"   R#   R$   R%   R   R@   (   R8   RJ   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyRG      s    c         C` s   |  j  } |  j r d } n d } |  j | k } x | D] } | j | d B q7 W|  j rd d } n d } |  j | k } x | D] } | j | d B q W|  j | k |  j | k g } x | D] } | j | d B q Wd  S(   Ng        g      4@u   requirediI (   R   R1   R&   R@   R0   R'   R    R!   (   R8   RA   t   suggestRB   RI   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   soft_constraints   s"    					c         C` s   | |  _  |  j   d S(   u8    replace the parent of this with the new parent
        N(   R   RH   (   R8   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt
   set_parent   s    	u   strongc         C` s_   |  j  | k |  j | k |  j | k |  j | k g } x" | D] } |  j j | | B q= Wd  S(   N(   R   R   R   R   R   R@   (   R8   R   R   R   R   t   strengthRJ   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_geometry   s    c         C` sk   |  j  | j  k |  j | j k |  j | j k |  j | j k g } x" | D] } |  j j | | B qI Wd S(   uJ   
        Make the layoutbox have same position as other layoutbox
        N(   R   R   R   R   R   R@   (   R8   t   otherRN   RJ   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_same   s    c         C` s1   |  j  |  j j  | k } |  j j | | B d  S(   N(   R   R   R   R@   (   R8   t   marginRN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_left_margin  s    c         C` s   |  j  j |  j |  d  S(   N(   R   R?   R,   (   R8   RR   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   edit_left_margin_min  s    c         C` s1   |  j  |  j j  | k } |  j j | | B d  S(   N(   R   R   R   R@   (   R8   RR   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_right_margin  s    c         C` s   |  j  j |  j |  d  S(   N(   R   R?   R-   (   R8   RR   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   edit_right_margin_min  s    c         C` s1   |  j  |  j j  | k } |  j j | | B d  S(   N(   R   R   R   R@   (   R8   RR   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_bottom_margin  s    c         C` s   |  j  j |  j |  d  S(   N(   R   R?   R.   (   R8   RR   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   edit_bottom_margin_min  s    c         C` s1   |  j  |  j j  | k } |  j j | | B d  S(   N(   R   R   R   R@   (   R8   RR   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_top_margin  s    c         C` s   |  j  j |  j |  d  S(   N(   R   R?   R/   (   R8   RR   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   edit_top_margin_min  s    c         C` s4   |  j  j   |  j j   |  j j   |  j j   f S(   N(   R   t   valueR   R    R!   (   R8   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   get_rect  s    c         C` s   |  j  j   d S(   uo   
        Update *all* the variables that are part of the solver this LayoutBox
        is created with
        N(   R   t   updateVariables(   R8   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   update_variables!  s    c         C` sY   |  j  } x6 |  j g D]( } | j |  s | j | |  q q W| j |  j |  d S(   u   
        Set the height of the layout box.

        This is done as an editable variable so that the value can change
        due to resizing.
        N(   R   R!   R=   R>   R?   (   R8   R!   RN   RA   RI   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   edit_height(  s
    	c         C` s'   |  j  | k } |  j j | | B d S(   ur   
        Constrain the height of the layout box.  height is
        either a float or a layoutbox.height.
        N(   R!   R   R@   (   R8   R!   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_height5  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R!   R   R@   (   R8   R!   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_height_min=  s    c         C` sY   |  j  } x6 |  j g D]( } | j |  s | j | |  q q W| j |  j |  d  S(   N(   R   R    R=   R>   R?   (   R8   R    RN   RA   RI   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt
   edit_widthA  s
    	c         C` s'   |  j  | k } |  j j | | B d S(   uq   
        Constrain the width of the layout box.  `width` is
        either a float or a layoutbox.width.
        N(   R    R   R@   (   R8   R    RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_widthH  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R    R   R@   (   R8   R    RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_width_minP  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R   R   R@   (   R8   R   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_leftT  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R   R   R@   (   R8   R   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_bottomX  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R   R   R@   (   R8   R   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_right\  s    c         C` s'   |  j  | k } |  j j | | B d  S(   N(   R   R   R@   (   R8   R   RN   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   constrain_top`  s    c         C` s$   |  j  j d  d } | d  d k S(   u]   
        Helper to check if this layoutbox is the layoutbox of a
        subplotspec
        u   .ii   u   ss(   R   t   split(   R8   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   _is_subplotspec_layoutboxd  s    c         C` s$   |  j  j d  d } | d  d k S(   uZ   
        Helper to check if this layoutbox is the layoutbox of a
        gridspec
        u   .ii   u   gridspec(   R   Ri   (   R8   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   _is_gridspec_layoutboxl  s    c         C` sC   |  j  r |  g } n g  } x! |  j D] } | | j   7} q% W| S(   u   
        Find children of this layout box that are subplots.  We want to line
        poss up, and this is an easy way to find them all.
        (   R   R3   t   find_child_subplots(   R8   t   subplotsRC   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyRl   t  s    	c   4   	   C` s0  t  d |  d | d | d |  } | j   } | j   \ } } |  j }	 d }
 d } d } d } | |
 } | | } d } d } | | | | d } | | } | j d k	 r | | } t t | j   } g  | j D] } | | | ^ q } n | g | } d g | g | d } t j	 j
 t j t t | |     } | | | | d } | | } | j d k	 r| | } t t | j   } g  | j D] } | | | ^ q} n | g | } d g | g | d } t j	 j
 t j t t | |     } g  t |  D] }  | | d	 |  ^ q}! g  t |  D] }  | | d	 |  d ^ q@}" g  t |  D] }# |
 | d	 |# ^ qo}$ g  t |  D] }# |
 | d	 |# d ^ q}% t | j |  \ }  }# |" |  }& |! |  }' |$ |# }( |% |# }) | j d k	 rt | j |  \ }* }+ |" |* }, |! |* }- |$ |+ }. |% |+ }/ t |& |,  }& t |( |.  }( t |' |-  }' t |) |/  }) n  |) |( }0 |' |& }1 |  j }	 |  j |	 j |	 j |( k |  j |	 j |	 j |& k |  j |	 j |0 k |  j |	 j |1 k g }2 x" |2 D] }3 |  j j |3 d
 B qW| S(   u    Make a layout box from a subplotspec. The layout box is
        constrained to be a fraction of the width/height of the parent,
        and be a fraction of the parent width/height from the left/bottom
        of the parent.  Therefore the parent can move around and the
        layout for the subplot spec should move with it.

        The parent is *usually* the gridspec that made the subplotspec.??
        R   R   R   R   g        g      ?i   i    i   u   requiredN(   R   t   get_gridspect   get_geometryR   t   _row_height_ratiosR   t   floatt   sumt   npt   addt
   accumulatet   ravelt   listt   zipt   _col_width_ratiost   ranget   divmodt   num1t   num2t   mint   maxR   R    R   R!   R   R@   (4   R8   t   subspecR   R   R   t   lbt   gst   nrowst   ncolsR   R   R   R   R   t   totWidtht	   totHeightt   hspacet   wspacet   cellHt   sepHt	   netHeightt   trt   rt   cellHeightst
   sepHeightst   cellHst   cellWt   sepWt   netWidtht
   cellWidthst	   sepWidthst   cellWst   rowNumt   figTopst
   figBottomst   colNumt   figLeftst	   figRightst	   figBottomt   figTopt   figLeftt   figRightt   rowNum2t   colNum2t
   figBottom2t   figTop2t   figLeft2t	   figRight2R    R!   t   csRB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   layout_from_subplotspec  sx    
!	



'

'*+/+/









	c         C` sD   |  j  |  j j   |  j j   |  j j   |  j j   f } d | S(   NuI   LayoutBox: %25s, (left: %1.3f) (bot: %1.3f) (right: %1.3f)  (top: %1.3f) (   R   R   R[   R   R   R   (   R8   t   args(    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   __repr__  s    N(   i    i    (   i   i   ()   t   __name__t
   __module__t   __doc__R   t   FalseR<   R5   R   RF   R2   RH   RG   RL   RM   RO   RQ   RS   RT   RU   RV   RW   RX   RY   RZ   R\   R^   R_   R`   Ra   Rb   Rc   Rd   Re   Rf   Rg   Rh   Rj   Rk   Rl   R   R   (    (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR   4   sP   		<	0						
												^u   strongc         C` s^   xW t  d t |    D]@ } |  | d j | |  | j k } |  | j j | | B q Wd S(   ub   
    Stack LayoutBox instances from left to right.
    `padding` is in figure-relative units.
    i   N(   Rz   t   lenR   R   R   R@   (   t   boxest   paddingRN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   hstack  s    "c         C` s^   xW t  d t |    D]@ } |  | d j | |  | j k } |  | j j | | B q Wd S(   u7   
    Stack LayoutBox instances from left to right.
    i   N(   Rz   R   R   R   R   R@   (   R   R   RN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   hpack  s    "c         C` s^   xW t  d t |    D]@ } |  | d j | |  | j k } |  | j j | | B q Wd S(   u6   
    Stack LayoutBox instances from top to bottom
    i   N(   Rz   R   R   R   R   R@   (   R   R   RN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   vstack  s    "c         C` s^   xW t  d t |    D]@ } |  | d j | |  | j k } |  | j j | | B q Wd S(   u6   
    Stack LayoutBox instances from top to bottom
    i   N(   Rz   R   R   R   R   R@   (   R   R   RN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   vpack  s    "u   mediumc         C` s   | d k r$ t j t |    } n  xg t d t |    D]P } |  | d j |  | j | | d | | k } |  | j j | | B q: Wd S(   u6   
    Stack LayoutBox instances from top to bottom
    i   N(   R   Rs   t   onesR   Rz   R!   R   R@   (   R   t   height_ratiosRN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_heights  s    $c         C` s   | d k r$ t j t |    } n  xg t d t |    D]P } |  | d j |  | j | | d | | k } |  | j j | | B q: Wd S(   u6   
    Stack LayoutBox instances from top to bottom
    i   N(   R   Rs   R   R   Rz   R    R   R@   (   R   t   width_ratiosRN   RI   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_widths  s    $c         C` s$   t  |  d | t |  d | d  S(   NR   R   (   R   R   (   R   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   vstackeq+  s    c         C` s$   t  |  d | t |  d | d  S(   NR   R   (   R   R   (   R   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   hstackeq0  s    c         C` sY   g  } xL |  d D]@ } t  |  d |  t  | |  k } |  d j j | | B q Wd  S(   Ni   i    (   t   getattrR   R@   (   R   t   attrRN   t   const   box(    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   align5  s    "i   c         C` s   |  d } | } x t  |  D] } | j } q Wxl |  d D]` } | } x t  |  D] } | j } qT W| j | j | j | j k } | j j | d B q; Wd  S(   Ni    i   u   strong(   Rz   R   R   R   R@   (   R   t   levelst   box0t   top0t   nR   t   topbRB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_top_margins<  s    
 c         C` s   |  d } | } x t  |  D] } | j } q Wxl |  d D]` } | } x t  |  D] } | j } qT W| j | j | j | j k } | j j | d B q; Wd  S(   Ni    i   u   strong(   Rz   R   R   R   R@   (   R   R   R   R   R   R   R   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_bottom_marginsI  s    
 c         C` s   |  d } | } x t  |  D] } | j } q Wxl |  d D]` } | } x t  |  D] } | j } qT W| j | j | j | j k } | j j | d B q; Wd  S(   Ni    i   u   strong(   Rz   R   R   R   R@   (   R   R   R   R   R   R   R   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_left_marginsV  s    
 c         C` s   |  d } | } x t  |  D] } | j } q Wxl |  d D]` } | } x t  |  D] } | j } qT W| j | j | j | j k } | j j | d B q; Wd  S(   Ni    i   u   strong(   Rz   R   R   R   R@   (   R   R   R   R   R   R   R   RB   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_right_marginsc  s    
 c         C` s$   t  |  d | t |  d | d  S(   NR   (   R   R   (   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_width_marginsp  s    c         C` s$   t  |  d | t |  d | d  S(   NR   (   R   R   (   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_height_marginsu  s    c         C` s$   t  |  d | t |  d | d  S(   NR   (   R   R   (   R   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   match_marginsz  s    c           C` s   d t  t  S(   uA   
    Generate a short sequential id for layoutbox objects...
    u   %06d(   t   nextt   _layoutboxobjnum(    (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   seq_id  s    c         C` s,   t  |   x |  j D] } t |  q Wd S(   u-   
    Print the children of the layoutbox
    N(   t   printR3   t   print_children(   R   RC   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR     s    
c         C` sI   |  d k	 rE |  j d k r5 |  j j   t |   qE t |  j  n  d S(   u]   
    Make all elements in this tree none...  This signals not to do any more
    layout.
    N(   R   R   R   t   resett   nonechildrent   nonetree(   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR     s
    c         C` s4   x |  j  D] } t |  q
 Wd  |  j _ d  }  d  S(   N(   R3   R   R   R   t
   _layoutbox(   R   RC   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR     s    c         C` sK   |  j  d k r: t d  t d  t |   t d  n t |  j   d S(   u'   
    Print the tree of layoutboxes
    u   LayoutBox Tree
u   ==============
u   
N(   R   R   R   R   t
   print_tree(   R   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR     s    


c         C` s2  d d l  } d d l j } t |  | j j  r |  j d d d d g  } | j d d d d g  | j d  |  j	 |  j
 j    n |  } d d l j } | j d j   d } | r t d	 |  n  x_| j D]T}	 |	 j   }
 | r t |	  n  | j | j |	 j j   |	 j j   f |	 j j   |	 j j   d
 d d d d | |  | d k r|	 j j d  d } | d d k r| j |	 j j   |	 j j   | d d | d | | q| j |	 j j   |	 j j   | d d d d d d | d | | n  t | |	 d | d d | q Wd S(   u1   
    Simple plotting to show where boxes are
    i    Ng        g      ?gffffff?g333333?u   axes.prop_cycleu   coloru   Level:t   fcu   nonet   alphag?t   ecu   .ii   t   sizei   t   colort   hau   rightt   vau   topt   leveli   t   printit(    t
   matplotlibt   matplotlib.pyplott   pyplott
   isinstancet   figuret   Figuret   add_axest   set_facecolort	   set_alphat   drawR   R   t   matplotlib.patchest   patchest   rcParamst   by_keyR   R3   R\   t	   add_patcht	   RectangleR   R[   R   R    R!   R   Ri   t   textR   R   t   plot_children(   R   R   R   R   R   t   pltt   axR   t   colorsRC   t   rectR   (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyR     sB    $$(.   R   t
   __future__R    R   R   R   t	   itertoolst
   kiwisolverR   t   loggingt   numpyRs   t   warningsR   t	   getLoggerR   R	   R   t   objectR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   t   countR   R   R   R   R   R   t   TrueR   (    (    (    s4   lib/python2.7/site-packages/matplotlib/_layoutbox.pyt   <module>   sD   "	 


	
					