
 m[c           @` sh  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 m Z d d l m Z d d l m Z d d l j Z d d l m Z m Z d d l j Z d d l m Z m Z d d	 l m Z d d
 l m Z d d l j Z d d l  m! Z! m" Z" m# Z# d d l$ m% Z% m& Z& d d l' m( Z( d d l) j* Z+ d d l, m- Z- d d l. m/ Z/ m0 Z0 d d l1 m2 Z2 m3 Z3 d d l4 m5 Z5 m6 Z6 m7 Z7 m8 Z8 d d l9 j: Z; d d l< m= Z= e j> e?  Z@ e jA jB d e/    d   ZC d e f d     YZD d eE f d     YZF d e f d     YZG d   ZH e jA jB d e jI eG   d S(   u5  
The figure module provides the top-level
:class:`~matplotlib.artist.Artist`, the :class:`Figure`, which
contains all the plot elements.  The following classes are defined

:class:`SubplotParams`
    control the default spacing of the subplots

:class:`Figure`
    Top level container for all plot elements.

i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   rcParams(   t	   docstring(   t   __version__(   t   Artistt   allow_rasterization(   t   Stackt   iterable(   t   image(   t   FigureImage(   t   Axest   SubplotBaset   subplot_class_factory(   t   BlockingMouseInputt   BlockingKeyMouseInput(   t   GridSpec(   t	   Rectangle(   t   get_projection_namest   process_projection_requirements(   t   Textt   _process_text_args(   t   Affine2Dt   Bboxt   BboxTransformTot   TransformedBbox(   t   NonGuiExceptiont   projection_namesc         C` s   |  j  r | |  j  _ n  d  S(   N(   t   figuret   stale(   t   selft   val(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _stale_figure_callback:   s    	t	   AxesStackc           B` sh   e  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  
    Specialization of the `.Stack` to handle all tracking of
    `~matplotlib.axes.Axes` in a `.Figure`.
    This stack stores ``key, (ind, axes)`` pairs, where:

        * **key** should be a hash of the args and kwargs
          used in generating the Axes.
        * **ind** is a serial number for tracking the order
          in which axes were added.

    The AxesStack is a callable, where ``ax_stack()`` returns
    the current axes. Alternatively the :meth:`current_key_axes` will
    return the current key and associated axes.

    c         C` s   t  j |   d |  _ d  S(   Ni    (   R	   t   __init__t   _ind(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR$   O   s    c         C` sI   g  |  j  D] \ } } | ^ q
 } | j   g  | D] \ } } | ^ q3 S(   uX   
        Return a list of the Axes instances that have been added to the figure
        (   t	   _elementst   sort(   R    t   kt   at   ia_listt   i(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   as_listS   s    "
c         C` s@   t  |  j  j |  } | d k r( d St j d d  | d S(   up   
        Return the Axes instance that was added with *key*.
        If it is not present, return None.
        u   2.1u)  Adding an axes using the same arguments as a previous axes currently reuses the earlier instance.  In a future version, a new instance will always be created and returned.  Meanwhile, this warning can be suppressed, and the future behavior ensured, by passing a unique label to each axes instance.i   N(   t   dictR&   t   gett   Nonet   cbookt   warn_deprecated(   R    t   keyt   item(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR.   [   s    c         C` s-   d   |  j  D | \ } } | | | f f S(   Nc         S` s+   i  |  ]! \ } \ } } | | f |  q S(    (    (   t   .0R(   t   indR)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pys
   <dictcomp>m   s   	 (   R&   (   R    t   eR5   R(   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _entry_from_axesl   s    c         C` s   t  j |  |  j |   d S(   u   Remove the axes from the stack.N(   R	   t   removeR7   (   R    R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR8   p   s    c         C` s   t  j |  |  j |   S(   ua   
        Move the given axes, which must already exist in the
        stack, to the top.
        (   R	   t   bubbleR7   (   R    R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR9   t   s    c         C` s   t  | t  s' t d j |    n  y t |  Wn t k
 rQ t   } n X|  j |  } | d k	 r t	 j
 |  | | f  t j d j |   n  | |  k r d S|  j d 7_ t	 j |  | |  j | f f  S(   u   
        Add Axes *a*, with key *key*, to the stack, and return the stack.

        If *key* is unhashable, replace it by a unique, arbitrary object.

        If *a* is already on the stack, don't add it again, but
        return *None*.
        u%   second argument, {!r}, is not an Axesu0   key {!r} already existed; Axes is being replacedi   N(   t
   isinstanceR   t
   ValueErrort   formatt   hasht	   TypeErrort   objectR.   R/   R	   R8   t   warningst   warnR%   t   push(   R    R2   R)   t
   a_existing(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   add{   s    c         C` sI   t  |  j  s |  j |  j f S|  j |  j \ } \ } } | | f Sd S(   u   
        Return a tuple of ``(key, axes)`` for the active axes.

        If no axes exists on the stack, then returns ``(None, None)``.
        N(   t   lenR&   t   _defaultt   _pos(   R    R2   t   indext   axes(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   current_key_axes   s    c         C` s   |  j    d S(   Ni   (   RJ   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __call__   s    c         C` s   | |  j    k S(   N(   R,   (   R    R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __contains__   s    (   t   __name__t
   __module__t   __doc__R$   R,   R.   R7   R8   R9   RD   RJ   RK   RL   (    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR#   ?   s   									t   SubplotParamsc           B` sM   e  Z d  Z d d d d d d d  Z d d d d d d d  Z d   Z RS(   u7   
    A class to hold the parameters for a subplot.
    c         C` s)   t  |  _ |  j | | | | | |  d S(   u  
        All dimensions are fractions of the figure width or height.
        Defaults are given by :rc:`figure.subplot.[name]`.

        Parameters
        ----------
        left : float
            The left side of the subplots of the figure.

        right : float
            The right side of the subplots of the figure.

        bottom : float
            The bottom of the subplots of the figure.

        top : float
            The top of the subplots of the figure.

        wspace : float
            The amount of width reserved for space between subplots,
            expressed as a fraction of the average axis width.

        hspace : float
            The amount of height reserved for space between subplots,
            expressed as a fraction of the average axis height.
        N(   t   Truet   validatet   update(   R    t   leftt   bottomt   rightt   topt   wspacet   hspace(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR$      s    	c         ` sM  t    d d
   t    d d
   t    d d
   t    d d
   t    d d
   t    d d
     j d |    j d |    j d |    j d |    j d |    j d |          f d   }   j rI  j   j k r|   t d   n    j   j k rI|   t d	   qIn  d
 S(   uY   
        Update the dimensions of the passed parameters. *None* means unchanged.
        u   leftu   rightu   topu   bottomu   wspaceu   hspacec           ` s:      _     _    _    _    _    _ d  S(   N(   RT   RV   RW   RU   RX   RY   (    (   R    t
   thisbottomt
   thishspacet   thisleftt	   thisrightt   thistopt
   thiswspace(    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   reset   s    					u   left cannot be >= rightu   bottom cannot be >= topN(	   t   getattrR/   t   _update_thisRR   RT   RV   R;   RU   RW   (   R    RT   RU   RV   RW   RX   RY   R`   (    (   R    RZ   R[   R\   R]   R^   R_   s0   lib/python2.7/site-packages/matplotlib/figure.pyRS      s(    !	c         C` sX   | d  k rD t |  | d   } | d  k rD d | } t | } qD n  t |  | |  d  S(   Nu   figure.subplot.(   R/   Ra   R   t   setattr(   R    t   sR!   R2   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyRb      s    
N(   RM   RN   RO   R/   R$   RS   Rb   (    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyRP      s   #t   Figurec        
   B` s  e  Z d  Z d   Z d   Z dY dY dY dY d dY dY dY dY d 	 Z e e j	 d d d d     Z
 d	   Z e d
  Z d   Z e d e d d  Z d   Z e d  Z e e e d d Z d   Z d   Z d   Z d   Z d   Z e d  Z d d d dY d  Z d   Z d   Z d   Z d   Z d    Z e j	 d!  dY d"   Z  d# d# dY dY dY dY dY dY e d$ 	 Z! dY e d%  Z" d&   Z# d'   Z$ d(   Z% d)   Z& d*   Z' d+   Z( d,   Z) d-   Z* d.   Z+ d/   Z, e d0  Z- e d1  Z. d2   Z/ d3   Z0 d4   Z1 d5   Z2 d6   Z3 d7 d7 e e e dY dY d8  Z4 d9   Z5 e d:  Z6 e d;  Z7 e8 d<    Z9 d=   Z: d>   Z; e< j= d?    Z> e< j= d@    Z? dA   Z@ e< j= dB    ZA dC   ZB dD   ZC dE   ZD dF   ZE dG   ZF dH   ZG e< j= dY dY e dI   ZH dJ   ZI d7 d e d7 dK dL dM  ZJ dN dO  ZK dP   ZL dQ   ZM dR   ZN dY dS  ZO dY dT dY dY dY dU  ZP dY dV  ZQ dY dW  ZR dY dX  ZS RS(Z   u  
    The top level container for all the plot elements.

    The Figure instance supports callbacks through a *callbacks* attribute
    which is a `.CallbackRegistry` instance.  The events you can connect to
    are 'dpi_changed', and the callback will be called with ``func(fig)`` where
    fig is the `Figure` instance.

    Attributes
    ----------
    patch
        The `.Rectangle` instance representing the figure patch.

    suppressComposite
        For multiple figure images, the figure will make composite images
        depending on the renderer option_image_nocomposite function.  If
        *suppressComposite* is a boolean, this will override the renderer.
    c         C` s   d t  |  j j  S(   Nu   Figure(%gx%g)(   t   tuplet   bboxt   size(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __str__  s    c      
   C` sE   d j  d |  j j d |  j j d d |  j j d d t |  j   S(   Nu.   <{clsname} size {h:g}x{w:g} with {naxes} Axes>t   clsnamet   hi    t   wi   t   naxes(   R<   t	   __class__RM   Rg   Rh   RE   RI   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __repr__  s    	 g        c
   
      C` sG  t  j |   |  ` t j   |  _ | d k r; t d } n  | d k rT t d } n  | d k rm t d } n  | d k r t d } n  | d k r t d } n  t j	 |  j
   s t d j |    n  t j d d |  |  _ t   j | |  |  _ | |  _ t |  j |  j  |  _ | |  _ t |  j  |  _ t d d d	 d
 d d
 d | d | d |  |  _ |  j |  j  |  j j t  t d |  _ |  j d k rt |  _ n  d |  _  d |  _! | d k rt"   } n  | |  _# d |  _$ |  j% |	  |  j& |  t'   |  _( |  j)   d |  _* t j+   |  _, t j+   |  _- d S(   u  
        Parameters
        ----------
        figsize : 2-tuple of floats, default: :rc:`figure.figsize`
            Figure dimension ``(width, height)`` in inches.

        dpi : float, default: :rc:`figure.dpi`
            Dots per inch.

        facecolor : default: :rc:`figure.facecolor`
            The figure patch facecolor.

        edgecolor : default: :rc:`figure.edgecolor`
            The figure patch edge color.

        linewidth : float
            The linewidth of the frame (i.e. the edge linewidth of the figure
            patch).

        frameon : bool, default: :rc:`figure.frameon`
            If ``False``, suppress drawing the figure frame.

        subplotpars : :class:`SubplotParams`
            Subplot parameters. If not given, the default subplot
            parameters :rc:`figure.subplot.*` are used.

        tight_layout : bool or dict, default: :rc:`figure.autolayout`
            If ``False`` use *subplotpars*. If ``True`` adjust subplot
            parameters using `.tight_layout` with default padding.
            When providing a dict containing the keys ``pad``, ``w_pad``,
            ``h_pad``, and ``rect``, the default `.tight_layout` paddings
            will be overridden.

        constrained_layout : bool
            If ``True`` use constrained layout to adjust positioning of plot
            elements.  Like ``tight_layout``, but designed to be more
            flexible.  See
            :doc:`/tutorials/intermediate/constrainedlayout_guide`
            for examples.  (Note: does not work with :meth:`.subplot` or
            :meth:`.subplot2grid`.)
            Defaults to :rc:`figure.constrained_layout.use`.
        u   figure.figsizeu
   figure.dpiu   figure.facecoloru   figure.edgecoloru   figure.frameonu!   figure size must be finite not {}i    t   xyt   widthi   t   heightt	   facecolort	   edgecolort	   linewidthu	   axes.holdN(   i    i    (.   R   R$   t   _axesR0   t   CallbackRegistryt	   callbacksR/   R   t   npt   isfinitet   allR;   R<   R   t   from_boundst   bbox_inchesR   t   scalet   dpi_scale_transt   _dpiR   Rg   t   frameonR   t   transFigureR   t   patcht   _set_artist_propst   set_aat   Falset   _holdRQ   t   canvast	   _suptitleRP   t   subplotparst
   _layoutboxt   set_constrained_layoutt   set_tight_layoutR#   t   _axstackt   clft   _cachedRenderert   Groupert   _align_xlabel_grpt   _align_ylabel_grp(
   R    t   figsizet   dpiRs   Rt   Ru   R   R   t   tight_layoutt   constrained_layout(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR$     sV    6							
	u   2.1t   alternativeu   `.Figure.patch`c         C` s   |  j  S(   N(   R   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   figurePatch  s    c         C` sE   |  j  d  k	 rA d |  j  j j k rA d d l m } | j |   Sd  S(   Nu   WebAggi    (   t   backend_webagg(   R   R/   Rn   RM   t   matplotlib.backendsR   t   ipython_inline_display(   R    R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _repr_html_  s    c         C` s   y t  |  j d  } Wn# t k
 r; } t d |   n X| d k	 rq y | j   d SWqq t k
 rm qq Xn  | r d d l } | j d  n  d S(   u@  
        If using a GUI backend with pyplot, display the figure window.

        If the figure was not created using
        :func:`~matplotlib.pyplot.figure`, it will lack a
        :class:`~matplotlib.backend_bases.FigureManagerBase`, and
        will raise an AttributeError.

        Parameters
        ----------
        warm : bool
            If ``True``, issue warning when called on a non-GUI backend

        Notes
        -----
        For non-GUI backends, this does nothing, in which case a warning will
        be issued if *warn* is ``True`` (default).
        u   manageru]   %s
Figure.show works only for figures managed by pyplot, normally created by pyplot.figure().Ni    uJ   matplotlib is currently using a non-GUI backend, so cannot show the figure(   Ra   R   t   AttributeErrorR/   t   showR   R@   RA   (   R    RA   t   managert   errR@   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    
c         C` s   |  j  j   S(   N(   R   R,   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt	   _get_axes  s    t   fgett   docu   List of axes in the Figure. You can access the axes in the Figure through this list. Do not modify the list itself. Instead, use `~Figure.add_axes`, `~.Figure.subplot` or `~.Figure.delaxes` to add or remove an axes.c         C` s   |  j  S(   N(   R   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _get_dpi  s    c         C` sa   | |  _  |  j j   j | |  |  j   \ } } |  j | | d | |  j j d |   d S(   u   
        Parameters
        ----------
        dpi : float

        forward : bool
            Passed on to `~.Figure.set_size_inches`
        t   forwardu   dpi_changedN(   R   R   t   clearR~   t   get_size_inchest   set_size_inchesRx   t   process(   R    R   R   Rl   Rk   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _set_dpi  s
    		u    The resolution in dots per inch.c         C` s   |  j  S(   u6   Return whether `.tight_layout` is called when drawing.(   t   _tight(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_tight_layout  s    c         C` sS   | d k r t d } n  t |  |  _ t | t  r= | n i  |  _ t |  _ d S(   u[  
        Set whether and how `.tight_layout` is called when drawing.

        Parameters
        ----------
        tight : bool or dict with keys "pad", "w_pad", "h_pad", "rect" or None
            If a bool, sets whether to call `.tight_layout` upon drawing.
            If ``None``, use the ``figure.autolayout`` rcparam instead.
            If a dict, pass it as kwargs to `.tight_layout`, overriding the
            default paddings.

            ..
                ACCEPTS: [ bool
                         | dict with keys "pad", "w_pad", "h_pad", "rect"
                         | None ]
        u   figure.autolayoutN(	   R/   R   t   boolR   R:   R-   t   _tight_parametersRQ   R   (   R    t   tight(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s
    c         C` s   |  j  S(   u   
        Return a boolean: True means constrained layout is being used.

        See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
        (   t   _constrained(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_constrained_layout  s    c         C` s   t    |  _ d |  j d <d |  j d <d |  j d <d |  j d <| d k rY t d } n  t |  |  _ t | t   r |  j |   n
 |  j   t |  _	 d S(   u%  
        Set whether ``constrained_layout`` is used upon drawing. If None,
        the rcParams['figure.constrained_layout.use'] value will be used.

        When providing a dict containing the keys `w_pad`, `h_pad`
        the default ``constrained_layout`` paddings will be
        overridden.  These pads are in inches and default to 3.0/72.0.
        ``w_pad`` is the width padding and ``h_pad`` is the height padding.

        ACCEPTS: [True | False | dict | None ]

        See :doc:`/tutorials/intermediate/constrainedlayout_guide`.
        u   w_padu   h_padu   wspaceu   hspaceu   figure.constrained_layout.useN(
   R-   t   _constrained_layout_padsR/   R   R   R   R:   t   set_constrained_layout_padsRQ   R   (   R    t   constrained(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    
c         K` sl   d d d d g } xS | D]K } | | k rO | | d k	 rO | | |  j | <q t d | |  j | <q Wd S(   u  
        Set padding for ``constrained_layout``.  Note the kwargs can be passed
        as a dictionary ``fig.set_constrained_layout(**paddict)``.

        See :doc:`/tutorials/intermediate/constrainedlayout_guide`.

        Parameters
        ----------

        w_pad : scalar
            Width padding in inches.  This is the pad around axes
            and is meant to make sure there is enough room for fonts to
            look good.  Defaults to 3 pts = 0.04167 inches

        h_pad : scalar
            Height padding in inches. Defaults to 3 pts.

        wspace: scalar
            Width padding between subplots, expressed as a fraction of the
            subplot width.  The total padding ends up being w_pad + wspace.

        hspace: scalar
            Height padding between subplots, expressed as a fraction of the
            subplot width. The total padding ends up being h_pad + hspace.

        u   w_padu   h_padu   wspaceu   hspaceu   figure.constrained_layout.N(   R/   R   R   (   R    t   kwargst   todot   td(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR   *  s
    c         C` s   |  j  d } |  j  d } |  j  d } |  j  d } | r | d k	 sR | d k	 r t j |   } | j } | | | j } | | | j } n  | | | | f S(   ux  
        Get padding for ``constrained_layout``.

        Returns a list of `w_pad, h_pad` in inches and
        `wspace` and `hspace` as fractions of the subplot.

        See :doc:`/tutorials/intermediate/constrainedlayout_guide`.

        Parameters
        ----------

        relative : boolean
            If `True`, then convert from inches to figure relative.
        u   w_padu   h_padu   wspaceu   hspaceN(   R   R/   t	   layoutboxt   get_rendererR   Rq   Rr   (   R    t   relativet   w_padt   h_padRX   RY   t	   renderer0R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_constrained_layout_padsN  s    	g?i   u   rightc         C` s2  t  d   |  j D  } t |  j  d k ro x |  j d j d |  D]  } | j |  | j |  qH Wn | rx |  j   D] } | j   r xn | j d |  D]  } | j |  | j |  q Wq x' | j d |  D] } | j t	  q W| j
 d  q Wn  | r%|  j d |  n  t |  _ d S(   uD  
        Date ticklabels often overlap, so it is useful to rotate them
        and right align them.  Also, a common use case is a number of
        subplots with shared xaxes where the x-axis is date data.  The
        ticklabels are often long, and it helps to rotate them on the
        bottom subplot and turn them off on other subplots, as well as
        turn off xlabels.

        Parameters
        ----------
        bottom : scalar
            The bottom of the subplots for :meth:`subplots_adjust`.

        rotation : angle in degrees
            The rotation of the xtick labels.

        ha : string
            The horizontal alignment of the xticklabels.

        which : {None, 'major', 'minor', 'both'}
            Selects which ticklabels to rotate. Default is None which works
            the same as major.
        c         s` s   |  ] } t  | d   Vq d S(   u   is_last_rowN(   t   hasattr(   R4   t   ax(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pys	   <genexpr>  s    i   i    t   whichu    RU   N(   R{   RI   RE   t   get_xticklabelst   set_hat   set_rotationt   get_axest   is_last_rowt   set_visibleR   t
   set_xlabelt   subplots_adjustRQ   R   (   R    RU   t   rotationt   haR   t   allsubplotst   labelR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   autofmt_xdatej  s"     c         C` s   |  j  g } | j |  j  | j |  j  | j |  j  | j |  j  | j |  j  | j |  j  | j |  j  | S(   u.   Get a list of artists contained in the figure.(	   R   t   extendt   artistsRI   t   linest   patchest   textst   imagest   legends(   R    t   children(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_children  s    c         C` sD   t  |  j  r |  j |  |  S|  j j | j | j  } | i  f S(   u|   
        Test whether the mouse event occurred on the figure.

        Returns
        -------
            bool, {}
        (   t   callablet	   _containsRg   t   containst   xt   y(   R    t
   mouseeventt   inside(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    c         O` s   |  j  S(   uY   
        Return the figure bounding box in display space. Arguments are ignored.
        (   Rg   (   R    t   argsR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_window_extent  s    c         K` s6  d | k p d | k } | j  d d  } | j  d d  } d | k ra d | k ra d | d <n  d | k r d	 | k r d
 | d <n  d | k r d | k r d | k r t d | d <n  d | k r d | k r t d | d <q n  |  j | | | |  } |  j d k	 rQ|  j j |  |  j j | | f  |  j j |  | j   n | |  _ d |  j _	 |  j	 d k	 r&| r&|  j
 d t  \ } } }	 }
 |  j	 } t j d | d |  j d | j d  |  j _	 xR | j D]D } | |  j j	 k	 rt j |  j j	 | g d | d d d qqWn  t |  _ |  j S(   uw  
        Add a centered title to the figure.

        kwargs are :class:`matplotlib.text.Text` properties.  Using figure
        coordinates, the defaults are:

          x : 0.5
            The x location of the text in figure coords

          y : 0.98
            The y location of the text in figure coords

          horizontalalignment : 'center'
            The horizontal alignment of the text

          verticalalignment : 'top'
            The vertical alignment of the text

        If the `fontproperties` keyword argument is given then the
        rcParams defaults for `fontsize` (`figure.titlesize`) and
        `fontweight` (`figure.titleweight`) will be ignored in favour
        of the `FontProperties` defaults.

        A :class:`matplotlib.text.Text` instance is returned.

        Example::

          fig.suptitle('this is the figure title', fontsize=12)
        u   xu   yg      ?g\(\?u   horizontalalignmentu   hau   centeru   verticalalignmentu   vau   topu   fontpropertiesu   fontsizeu   sizeu   figure.titlesizeu
   fontweightu   weightu   figure.titleweightR   t   parentt   artistt   nameu	   .suptitlet   paddingg       @t   strengthu   requiredN(   t   popR   t   textR   R/   t   set_textt   set_positiont   update_fromR8   R   R   RQ   R   t	   LayoutBoxR   R   t   vstackR   (   R    t   tR   t   manual_positionR   R   t   supR   R   RX   RY   t   figlbt   child(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   suptitle  sB    					c         C` s   | |  _  d S(   uc   
        Set the canvas that contains the figure

        ACCEPTS: a FigureCanvas instance
        N(   R   (   R    R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt
   set_canvas  s    u   2.0c         C` s)   | d k r |  j |  _ n	 | |  _ d S(   u<  
        Set the hold state.  If hold is None (default), toggle the
        hold state.  Else set the hold state to boolean value b.

        e.g.::

            hold()      # toggle hold
            hold(True)  # hold is on
            hold(False) # hold is off

        All "hold" machinery is deprecated.
        N(   R/   R   (   R    t   b(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   hold  s    i    c         ` s     j  s   j   n  |
 ro   j   } g  | j d | j d f D] } | | ^ qC }   j | d t n  t   | | | | |	 |  } t | _ | j	 |  | j
 |  | d k r | j | |  n    j j |    f d   | _ t   _ | S(   u  
        Add a non-resampled image to the figure.

        The image is attached to the lower or upper left corner depending on
        *origin*.

        Parameters
        ----------
        X
            The image data. This is an array of one of the following shapes:

            - MxN: luminance (grayscale) values
            - MxNx3: RGB values
            - MxNx4: RGBA values

        xo, yo : int
            The *x*/*y* image offset in pixels.

        alpha : None or float
            The alpha blending value.

        norm : :class:`matplotlib.colors.Normalize`
            A :class:`.Normalize` instance to map the luminance to the
            interval [0, 1].

        cmap : str or :class:`matplotlib.colors.Colormap`
            The colormap to use. Default: :rc:`image.cmap`.

        vmin, vmax : scalar
            If *norm* is not given, these values set the data limits for the
            colormap.

        origin : {'upper', 'lower'}
            Indicates where the [0, 0] index of the array is in the upper left
            or lower left corner of the axes. Defaults to :rc:`image.origin`.

        resize : bool
            If *True*, resize the figure to match the given image size.

        Returns
        -------
        :class:`matplotlib.image.FigureImage`

        Other Parameters
        ----------------
        **kwargs
            Additional kwargs are `.Artist` kwargs passed on to `.FigureImage`.

        Notes
        -----
        figimage complements the axes image
        (:meth:`~matplotlib.axes.Axes.imshow`) which will be resampled
        to fit the current axes.  If you want a resampled image to
        fill the entire figure, you can define an
        :class:`~matplotlib.axes.Axes` with extent [0,0,1,1].


        Examples::

            f = plt.figure()
            nx = int(f.get_figwidth() * f.dpi)
            ny = int(f.get_figheight() * f.dpi)
            data = np.random.random((ny, nx))
            f.figimage(data)
            plt.show()

        i   i    R   c         ` s     j  j |   S(   N(   R   R8   (   Rk   (   R    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   <lambda>p  s    N(   R   R   t   get_dpit   shapeR   RQ   R   R"   t   stale_callbackt	   set_arrayt	   set_alphaR/   t   set_climR   t   appendt   _remove_methodR   (   R    t   Xt   xot   yot   alphat   normt   cmapt   vmint   vmaxt   origint   resizeR   R   R   R   t   im(    (   R    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   figimage  s     F	1		c   
      C` s  | d k r | \ } } n  t d   | | f D  sR t d j | |    n  | | f |  j _ | rt |  d  } | d k	 rt |  j d d  } |  j | } | | } | | } t |  j d d  }	 |	 d k	 r |	 j	 t
 |  t
 |   q qn  t |  _ d S(   u  Set the figure size in inches (1in == 2.54cm)

        Usage ::

             fig.set_size_inches(w, h)  # OR
             fig.set_size_inches((w, h))

        optional kwarg *forward=True* will cause the canvas size to be
        automatically updated; e.g., you can resize the figure window
        from the shell

        ACCEPTS: a w, h tuple with w, h in inches

        See Also
        --------
        matplotlib.Figure.get_size_inches
        c         s` s   |  ] } t  j |  Vq d  S(   N(   Ry   Rz   (   R4   t   _(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pys	   <genexpr>  s    u'   figure size must be finite not ({}, {})u   canvasu
   _dpi_ratioi   u   managerN(   R/   R{   R;   R<   R}   t   p1Ra   R   R   R	  t   intRQ   R   (
   R    Rl   Rk   R   R   t   ratiot   dpivalt   canvaswt   canvashR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR   t  s"    	

%c         C` s   t  j |  j j  S(   u  
        Returns the current size of the figure in inches.

        Returns
        -------
        size : ndarray
           The size (width, height) of the figure in inches.

        See Also
        --------
        matplotlib.Figure.set_size_inches
        (   Ry   t   arrayR}   R  (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    c         C` s   |  j  j   S(   u+   Get the edge color of the Figure rectangle.(   R   t   get_edgecolor(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    c         C` s   |  j  j   S(   u+   Get the face color of the Figure rectangle.(   R   t   get_facecolor(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    c         C` s
   |  j  j S(   u#   Return the figure width as a float.(   R}   Rq   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_figwidth  s    c         C` s
   |  j  j S(   u$   Return the figure height as a float.(   R}   Rr   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_figheight  s    c         C` s   |  j  S(   u2   Return the resolution in dots per inch as a float.(   R   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    c         C` s   |  j  S(   u.   Return whether the figure frame will be drawn.(   R   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   get_frameon  s    c         C` s   |  j  j |  d S(   uw   
        Set the edge color of the Figure rectangle.

        ACCEPTS: any matplotlib color - see help(colors)
        N(   R   t   set_edgecolor(   R    t   color(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    c         C` s   |  j  j |  d S(   uw   
        Set the face color of the Figure rectangle.

        ACCEPTS: any matplotlib color - see help(colors)
        N(   R   t   set_facecolor(   R    R  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    c         C` s   | |  _  t |  _ d S(   uN   
        Set the dots-per-inch of the figure.

        ACCEPTS: float
        N(   R   RQ   R   (   R    R!   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   set_dpi  s    	c         C` s    |  j  | |  j   d | d S(   uP   
        Set the width of the figure in inches.

        ACCEPTS: float
        R   N(   R   R  (   R    R!   R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   set_figwidth  s    c         C` s    |  j  |  j   | d | d S(   uQ   
        Set the height of the figure in inches.

        ACCEPTS: float
        R   N(   R   R  (   R    R!   R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   set_figheight  s    c         C` s   | |  _  t |  _ d S(   uo   
        Set whether the figure frame (background) is displayed or invisible

        ACCEPTS: boolean
        N(   R   RQ   R   (   R    R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   set_frameon  s    	c         C` s;   |  j  j |  x |  j D] } | |   q Wt |  _ d S(   un   
        Remove the `~matplotlib.axes.Axes` *ax* from the figure and update the
        current axes.
        N(   R   R8   t   _axobserversRQ   R   (   R    R   t   func(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   delaxes  s    c         O` s7   d   } d   } | |  | t  j |   f } | S(   u+   Make a hashable key out of args and kwargs.c         S` s^   g  } xK |  D]C \ } } y t  |  } Wn t k
 r< n X| j | | f  q Wt  |  S(   N(   Rf   t	   ExceptionR   (   t   itemst   retR(   t   v(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   fixitems  s    c         S` sI   g  } x6 |  D]. } t  |  r. t |  } n  | j |  q Wt |  S(   N(   R
   Rf   R   (   R   R%  R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   fixlist  s    (   t   sixt	   iteritems(   R    R   R   R'  R(  R2   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt	   _make_key  s    		!c         O` sj  t  |  s d S|  j | |   } |  j j |  } | d k	 rQ |  j |  | St | d t  r | d } | j   |  k	 r(t	 d   q(n | d } t
 j |  j   s t	 d j |    n  t |  | |  \ } } } |  j j |  } t | |  r|  j |  | S| |  | |  } |  j j | |  |  j |  |  j | _ t |  _ t | _ | S(   u  
        Add an axes to the figure.

        Call signature::

            add_axes(rect, projection=None, polar=False, **kwargs)

        Parameters
        ----------
        rect : sequence of float
            The dimensions [left, bottom, width, height] of the new axes. All
            quantities are in fractions of figure width and height.

        projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', rectilinear'}, optional
            The projection type of the axes.

        polar : boolean, optional
            If True, equivalent to projection='polar'.

        **kwargs
            This method also takes the keyword arguments for
            :class:`~matplotlib.axes.Axes`.

        Returns
        -------
        axes : Axes
            The added axes.

        Examples
        --------
        Some simple examples::

            rect = l, b, w, h
            fig.add_axes(rect)
            fig.add_axes(rect, frameon=False, facecolor='g')
            fig.add_axes(rect, polar=True)
            fig.add_axes(rect, projection='polar')
            fig.add_axes(ax)

        If the figure already has an axes with the same parameters, then it
        will simply make that axes current and return it.  This behavior
        has been deprecated as of Matplotlib 2.1.  Meanwhile, if you do
        not want this behavior (i.e., you want to force the creation of a
        new Axes), you must use a unique set of args and kwargs.  The axes
        :attr:`~matplotlib.axes.Axes.label` attribute has been exposed for this
        purpose: if you want two axes that are otherwise identical to be added
        to the figure, make sure you give them unique labels::

            fig.add_axes(rect, label='axes1')
            fig.add_axes(rect, label='axes2')

        In rare circumstances, add_axes may be called with a single
        argument, an Axes instance already created in the present
        figure but not in the figure's list of axes.  For example,
        if an axes has been removed with :meth:`delaxes`, it can
        be restored with::

            fig.add_axes(ax)

        In all cases, the :class:`~matplotlib.axes.Axes` instance
        will be returned.
        Ni    u5   The Axes must have been created in the present figureu)   all entries in rect must be finite not {}(   RE   R+  R   R.   R/   t   scaR:   R   t
   get_figureR;   Ry   Rz   R{   R<   R   RD   t   _Figure__remove_axR   RQ   R   R"   R   (   R    R   R   R2   R   R)   t   rectt   projection_class(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   add_axes  s:    @

			c         O` s  t  |  s d St  |  d k r t | d t  r d | d k oP d k n sq t d j | d    n  t t t t | d    } n  t | d t  r | d } | j	   |  k	 r t d   n  |  j
 | |   } n t |  | |  \ } } } |  j j |  } | d k	 rRt | |  r?|  j |  | S|  j j |  n  t |  |  | |  } |  j j | |  |  j |  |  j | _ t |  _ t | _ | S(   ur  
        Add a subplot.

        Call signatures::

           add_subplot(nrows, ncols, index, **kwargs)
           add_subplot(pos, **kwargs)

        Parameters
        ----------
        *args
            Either a 3-digit integer or three separate integers
            describing the position of the subplot. If the three
            integers are R, C, and P in order, the subplot will take
            the Pth position on a grid with R rows and C columns.

        projection : {None, 'aitoff', 'hammer', 'lambert', 'mollweide', 'polar', rectilinear'}, optional
            The projection type of the axes.

        polar : boolean, optional
            If True, equivalent to projection='polar'.

        **kwargs
            This method also takes the keyword arguments for
            :class:`~matplotlib.axes.Axes`.

        Returns
        -------
        axes : Axes
            The axes of the subplot.

        Notes
        -----
        If the figure already has a subplot with key (*args*,
        *kwargs*) then it will simply make that subplot current and
        return it.  This behavior is deprecated.

        Examples
        --------
        ::

            fig.add_subplot(111)

            # equivalent but more general
            fig.add_subplot(1, 1, 1)

            # add subplot with red background
            fig.add_subplot(212, facecolor='r')

            # add a polar subplot
            fig.add_subplot(111, projection='polar')

            # add Subplot instance sub
            fig.add_subplot(sub)

        See Also
        --------
        matplotlib.pyplot.subplot : for an explanation of the args.
        Ni   i    id   i  uB   Integer subplot specification must be a three-digit number, not {}u8   The Subplot must have been created in the present figure(   RE   R:   R  R;   R<   Rf   t   mapt   strR   R-  R+  R   R   R.   R/   R,  R8   R   RD   R.  R   RQ   R   R"   R   (   R    R   R   R)   R2   R0  R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   add_subplot  s8    =% 	"
		i   c         C` s  t  | t  r$ | r d n d } n  t  | t  rH | r? d n d } n  d d d d g } | | k r t  | t  r t j d  n  t d | | f   n  | | k r t d | | f   n  | d k r i  } n  | d k r i  } n  |  j   rt | | d |  | }	 n t | | d d | }	 t	 j
 | | f d	 t }
 x t |  D] } x t |  D] } i d d 6|
 d d 6|
 | d
 f d 6|
 d
 | f d 6} | | | d <| | | d <|  j |	 | | f |  |
 | | f <qgWqTW| d k r\x\ |
 d d  d d  f j D]8 } | j j d d d t d t  | j j j t  qWn  | d k rx\ |
 d d  d d  f j D]8 } | j j d d d t d t  | j j j t  qWn  | r|
 j d k r|
 j   S|
 j   S|
 Sd S(   u	  
        Add a set of subplots to this figure.

        Parameters
        ----------
        nrows, ncols : int, default: 1
            Number of rows/cols of the subplot grid.

        sharex, sharey : bool or {'none', 'all', 'row', 'col'}, default: False
            Controls sharing of properties among x (`sharex`) or y (`sharey`)
            axes:

                - True or 'all': x- or y-axis will be shared among all
                  subplots.
                - False or 'none': each subplot x- or y-axis will be
                  independent.
                - 'row': each subplot row will share an x- or y-axis.
                - 'col': each subplot column will share an x- or y-axis.

            When subplots have a shared x-axis along a column, only the x tick
            labels of the bottom subplot are created. Similarly, when subplots
            have a shared y-axis along a row, only the y tick labels of the
            first column subplot are created. To later turn other subplots'
            ticklabels on, use :meth:`~matplotlib.axes.Axes.tick_params`.

        squeeze : bool, optional, default: True
            - If True, extra dimensions are squeezed out from the returned
              array of Axes:

                - if only one subplot is constructed (nrows=ncols=1), the
                  resulting single Axes object is returned as a scalar.
                - for Nx1 or 1xM subplots, the returned object is a 1D numpy
                  object array of Axes objects.
                - for NxM, subplots with N>1 and M>1 are returned
                  as a 2D array.

            - If False, no squeezing at all is done: the returned Axes object
              is always a 2D array containing Axes instances, even if it ends
              up being 1x1.

        subplot_kw : dict, default: {}
            Dict with keywords passed to the
            :meth:`~matplotlib.figure.Figure.add_subplot` call used to create
            each subplots.

        gridspec_kw : dict, default: {}
            Dict with keywords passed to the
            :class:`~matplotlib.gridspec.GridSpec` constructor used to create
            the grid the subplots are placed on.

        Returns
        -------
        ax : single Axes object or array of Axes objects
            The added axes.  The dimensions of the resulting array can be
            controlled with the squeeze keyword, see above.

        See Also
        --------
        pyplot.subplots : pyplot API; docstring includes examples.
        u   allu   noneu   rowu   colu\   sharex argument to subplots() was an integer. Did you intend to use subplot() (without 's')?u   sharex [%s] must be one of %su   sharey [%s] must be one of %sR   t   dtypei    u   sharexu   shareyNiR   u   botht   labelbottomt   labeltopi   t	   labelleftt
   labelright(   i    i    (   u   colu   all(   u   rowu   all(   R:   R   R  R@   RA   R;   R/   R   R   Ry   t   emptyR?   t   rangeR4  t   flatt   xaxist   set_tick_paramsR   t
   offsetTextR   t   yaxisRh   R3   t   squeeze(   R    t   nrowst   ncolst   sharext   shareyRA  t
   subplot_kwt   gridspec_kwt   share_valuest   gst   axarrt   rowt   colt   shared_withR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   subplots  sT    @
		%.&&#c         C` s   d   } d   } |  j  |  | | | j  } | d  k	 rM | | j  n  | | | j  } | d  k	 r{ | | j  n  d  S(   Nc         S` sP   |  j  |  j    |  j |  j    |  j |  j    |  j |  j    d  S(   N(   t   set_major_formattert   get_major_formattert   set_major_locatort   get_major_locatort   set_minor_formattert   get_minor_formattert   set_minor_locatort   get_minor_locator(   t   axis(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _reset_loc_formr  s    c         S` sY   | j  |   } t |  d k rU | j |   x$ | D] } |  | k rM q5 n  | SWn  d  S(   Ni   (   t   get_siblingsRE   R8   R/   (   R   t   groupert   siblingst   last_ax(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   _break_share_linkx  s    (   R"  t   _shared_y_axesR/   R@  t   _shared_x_axesR=  (   R    R   RX  R]  R\  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __remove_axq  s    		
c         C` s  d |  _ t j   |  _ x. t |  j  D] } | j   |  j |  q( Wt	 |  j
 d d  } | d k	 rw | j   n  |  j j   g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ g  |  _ | s g  |  _ n  d |  _ |  j   r t j |  j  n  t |  _ d S(   u   
        Clear the figure.

        Set *keep_observers* to True if, for example,
        a gui widget is tracking the axes in the figure.
        u   toolbarN(   R/   t   suppressCompositeR0   Rw   Rx   Rf   RI   t   claR"  Ra   R   RS   R   R   R   R   R   R   R   R   R   R   R   R   t   nonetreeR   RQ   R   (   R    t   keep_observersR   t   toolbar(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s*    	
							c         C` s   |  j  d |  d S(   u>   
        Clear the figure -- synonym for :meth:`clf`.
        Rd  N(   R   (   R    Rd  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    c         C` sJ  |  j    s d St d   |  j |  j |  j |  j |  j |  j |  j D d d   } z | j	 d  |  j
   r |  j r t r |  j |  q n  |  j   r |  j r y |  j | |  j  Wq t k
 r q Xn  |  j r |  j j |  n  t j | |  | |  j  | j d  Wd t |  _ X| |  _ |  j j |  d S(   uu   
        Render the figure using :class:`matplotlib.backend_bases.RendererBase`
        instance *renderer*.
        Nc         s` s!   |  ] } | j    s | Vq d  S(   N(   t   get_animated(   R4   R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pys	   <genexpr>  s    R2   c         S` s
   |  j    S(   N(   t
   get_zorder(   R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    u   figure(   t   get_visiblet   sortedR   R   R   R   RI   R   R   t
   open_groupR   RQ   t   execute_constrained_layoutR   R   R   R;   R   R   t   drawt   mimaget   _draw_list_compositing_imagesRa  t   close_groupR   R   R   R   t
   draw_event(   R    t   rendererR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyRl    s4    7		
	c         C` s2   |  j  d k r t d   n  | j |  j   d S(   u   
        Draw :class:`matplotlib.artist.Artist` instance *a* only.
        This is available only after the figure is drawn.
        uL   draw_artist can only be used after an initial draw which caches the rendererN(   R   R/   R   Rl  (   R    R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   draw_artist  s    c         C` s   |  j  S(   uY  
        Return a list of axes in the Figure. You can access and modify the
        axes in the Figure through this list.

        Do not modify the list itself. Instead, use `~Figure.add_axes`,
        `~.Figure.subplot` or `~.Figure.delaxes` to add or remove an axes.

        Note: This is equivalent to the property `~.Figure.axes`.
        (   RI   (   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    
c         ` s}   t  j   j | |  \ } } } } t |  r3 n  t  j   | | | |  }   j j |    f d   | _ t   _	 | S(   ub"  
        Place a legend on the figure.

        To make a legend from existing artists on every axes::

          legend()

        To make a legend for a list of lines and labels::

          legend( (line1, line2, line3),
                  ('label1', 'label2', 'label3'),
                  loc='upper right')

        These can also be specified by keyword::

          legend(handles=(line1, line2, line3),
                labels=('label1', 'label2', 'label3'),
                loc='upper right')

        Parameters
        ----------

        handles : sequence of `.Artist`, optional
            A list of Artists (lines, patches) to be added to the legend.
            Use this together with *labels*, if you need full control on what
            is shown in the legend and the automatic mechanism described above
            is not sufficient.

            The length of handles and labels should be the same in this
            case. If they are not, they are truncated to the smaller length.

        labels : sequence of strings, optional
            A list of labels to show next to the artists.
            Use this together with *handles*, if you need full control on what
            is shown in the legend and the automatic mechanism described above
            is not sufficient.

        Other Parameters
        ----------------

        loc : int or string or pair of floats, default: 'upper right'
            The location of the legend. Possible codes are:

                ===============   =============
                Location String   Location Code
                ===============   =============
                'best'            0
                'upper right'     1
                'upper left'      2
                'lower left'      3
                'lower right'     4
                'right'           5
                'center left'     6
                'center right'    7
                'lower center'    8
                'upper center'    9
                'center'          10
                ===============   =============


            Alternatively can be a 2-tuple giving ``x, y`` of the lower-left
            corner of the legend in axes coordinates (in which case
            ``bbox_to_anchor`` will be ignored).

        bbox_to_anchor : `.BboxBase` or pair of floats
            Specify any arbitrary location for the legend in `bbox_transform`
            coordinates (default Axes coordinates).

            For example, to put the legend's upper right hand corner in the
            center of the axes the following keywords can be used::

               loc='upper right', bbox_to_anchor=(0.5, 0.5)

        ncol : integer
            The number of columns that the legend has. Default is 1.

        prop : None or :class:`matplotlib.font_manager.FontProperties` or dict
            The font properties of the legend. If None (default), the current
            :data:`matplotlib.rcParams` will be used.

        fontsize : int or float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
            Controls the font size of the legend. If the value is numeric the
            size will be the absolute font size in points. String values are
            relative to the current default font size. This argument is only
            used if `prop` is not specified.

        numpoints : None or int
            The number of marker points in the legend when creating a legend
            entry for a `.Line2D` (line).
            Default is ``None``, which will take the value from
            :rc:`legend.numpoints`.

        scatterpoints : None or int
            The number of marker points in the legend when creating
            a legend entry for a `.PathCollection` (scatter plot).
            Default is ``None``, which will take the value from
            :rc:`legend.scatterpoints`.

        scatteryoffsets : iterable of floats
            The vertical offset (relative to the font size) for the markers
            created for a scatter plot legend entry. 0.0 is at the base the
            legend text, and 1.0 is at the top. To draw all markers at the
            same height, set to ``[0.5]``. Default is ``[0.375, 0.5, 0.3125]``.

        markerscale : None or int or float
            The relative size of legend markers compared with the originally
            drawn ones.
            Default is ``None``, which will take the value from
            :rc:`legend.markerscale`.

        markerfirst : bool
            If *True*, legend marker is placed to the left of the legend label.
            If *False*, legend marker is placed to the right of the legend
            label.
            Default is *True*.

        frameon : None or bool
            Control whether the legend should be drawn on a patch
            (frame).
            Default is ``None``, which will take the value from
            :rc:`legend.frameon`.

        fancybox : None or bool
            Control whether round edges should be enabled around the
            :class:`~matplotlib.patches.FancyBboxPatch` which makes up the
            legend's background.
            Default is ``None``, which will take the value from
            :rc:`legend.fancybox`.

        shadow : None or bool
            Control whether to draw a shadow behind the legend.
            Default is ``None``, which will take the value from
            :rc:`legend.shadow`.

        framealpha : None or float
            Control the alpha transparency of the legend's background.
            Default is ``None``, which will take the value from
            :rc:`legend.framealpha`.  If shadow is activated and
            *framealpha* is ``None``, the default value is ignored.

        facecolor : None or "inherit" or a color spec
            Control the legend's background color.
            Default is ``None``, which will take the value from
            :rc:`legend.facecolor`.  If ``"inherit"``, it will take
            :rc:`axes.facecolor`.

        edgecolor : None or "inherit" or a color spec
            Control the legend's background patch edge color.
            Default is ``None``, which will take the value from
            :rc:`legend.edgecolor` If ``"inherit"``, it will take
            :rc:`axes.edgecolor`.

        mode : {"expand", None}
            If `mode` is set to ``"expand"`` the legend will be horizontally
            expanded to fill the axes area (or `bbox_to_anchor` if defines
            the legend's size).

        bbox_transform : None or :class:`matplotlib.transforms.Transform`
            The transform for the bounding box (`bbox_to_anchor`). For a value
            of ``None`` (default) the Axes'
            :data:`~matplotlib.axes.Axes.transAxes` transform will be used.

        title : str or None
            The legend's title. Default is no title (``None``).

        borderpad : float or None
            The fractional whitespace inside the legend border.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.borderpad`.

        labelspacing : float or None
            The vertical space between the legend entries.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.labelspacing`.

        handlelength : float or None
            The length of the legend handles.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.handlelength`.

        handletextpad : float or None
            The pad between the legend handle and text.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.handletextpad`.

        borderaxespad : float or None
            The pad between the axes and legend border.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.borderaxespad`.

        columnspacing : float or None
            The spacing between columns.
            Measured in font-size units.
            Default is ``None``, which will take the value from
            :rc:`legend.columnspacing`.

        handler_map : dict or None
            The custom dictionary mapping instances or types to a legend
            handler. This `handler_map` updates the default handler map
            found at :func:`matplotlib.legend.Legend.get_legend_handler_map`.

        Returns
        -------
        :class:`matplotlib.legend.Legend` instance

        Notes
        -----
        Not all kinds of artist are supported by the legend command. See
        :doc:`/tutorials/intermediate/legend_guide` for details.
        c         ` s     j  j |   S(   N(   R   R8   (   Rk   (   R    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    (
   t   mlegendt   _parse_legend_argsRI   RE   t   LegendR   R   R   RQ   R   (   R    R   R   t   handlest   labelst
   extra_argst   l(    (   R    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   legend  s    		c         ` sv   t  i  | |  } t d | d | d |  } | j |    j |    j j |    f d   | _ t   _ | S(   un  
        Add text to figure.

        Call signature::

          text(x, y, s, fontdict=None, **kwargs)

        Add text to figure at location *x*, *y* (relative 0-1
        coords). See :func:`~matplotlib.pyplot.text` for the meaning
        of the other arguments.

        kwargs control the :class:`~matplotlib.text.Text` properties:

        %(Text)s
        R   R   R   c         ` s     j  j |   S(   N(   R   R8   (   Rk   (   R    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    (	   R   R   RS   R   R   R   R   RQ   R   (   R    R   R   Rd   R   R   t   overrideR   (    (   R    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    	c         C` s9   | |  k r | j  |   n  t | _ | j |  j  d  S(   N(   t
   set_figureR"   R   t   set_transformR   (   R    R)   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR      s    	c         K` s   |  j  j   \ } } | d k	 r | s+ | S| j   } t |  |  \ } } } | d } | d } | | k r t | |  r | St j d d d n  |  j d d d |  S(   u  
        Get the current axes, creating one if necessary.

        The following kwargs are supported for ensuring the returned axes
        adheres to the given projection etc., and for axes creation if
        the active axes does not exist:

        %(Axes)s

        i   ul   Requested projection is different from current axis projection, creating new axis with requested projection.t
   stackleveli   N(	   R   RJ   R/   t   copyR   R:   R@   RA   R4  (   R    R   t   ckeyt   caxt   kwargs_copyR0  R  R2   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   gca  s    


c         C` s2   |  j  j |  x |  j D] } | |   q W| S(   u*   Set the current axes to be a and return a.(   R   R9   R   (   R    R)   R!  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR,  6  s    c         C` sy   |  j  j   d } | d k r# d S| j   } | d k	 r? | Sx3 t |  j  D]" } | j   } | d k	 rO | SqO Wd S(   uR   
        Helper for :func:`~matplotlib.pyplot.gci`. Do not use elsewhere.
        i   N(   R   RJ   R/   t   _gcit   reversedRI   (   R    R  R
  R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR  =  s    c         C` s   t  t |   j   } x d
 D] } | j | d   q Wt | d <t |  j d d   d  k	 r |  j j } d d  l	 } | t
 t j | j j j   k r t | d <q n  | j d	 d   |  j d  k	 r d  |  j _ n  | S(   Nu   _axobserversu   showu   canvasu   _cachedRendereru   __mpl_version__u   manageri    u   _restore_to_pylabu
   _layoutbox(   u   _axobserversu   showu   canvasu   _cachedRenderer(   t   superRe   t   __getstate__R   R/   t   _mpl_versionRa   R   R   t   matplotlib._pylab_helperst   listR)  t
   itervaluest   _pylab_helperst   Gcft   figsRQ   R   R   (   R    t   statet   attr_to_popR   t
   matplotlib(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR  R  s    

c   	      ` sT  | j  d  } | j  d t  } | t k rP d d  l } | j d | f  n  | |  _ g  |  _ d  |  _ d  |  _	 | rGd d  l
 j } d d  l j  | j   } | r t |  d n d } | j j | |     |  j   r   j |  j    n     f d   }   j j d |    _  j j    | |  _ | j   n  t |  _ d  S(   Nu   __mpl_version__u   _restore_to_pylabi    uW   This figure was saved with matplotlib version %s and is unlikely to function correctly.i   c         ` s    j  j    d  S(   N(   R  t
   set_active(   t   event(   t   mgrt   pylab_helpers(    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   make_active  s    u   button_press_event(   R   R   R  R@   RA   t   __dict__R   R/   R   R   t   matplotlib.pyplott   pyplotR  R  t   get_fignumst   maxt   _backend_modt   new_figure_manager_given_figuret	   get_labelt   set_window_titlet   mpl_connectt   _cidgcfR  R  t   numbert   draw_if_interactiveRQ   R   (	   R    R  t   versiont   restore_to_pylabR@   t   pltt   allnumst   numR  (    (   R  R  s0   lib/python2.7/site-packages/matplotlib/figure.pyt   __setstate__t  s2    						c         C` s   |  j  j |  d S(   u>   Whenever the axes state change, ``func(self)`` will be called.N(   R   R   (   R    R!  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   add_axobserver  s    c   
      K` s  | j  d t d  | j d t d  } | j d t d  } | r | j  d d  | j  d	 d  g  } x~ |  j D]H } | j } | j | j   | j   f  | j d  | j	 d  qv Wn( | j  d t d
  | j  d	 t d  | r|  j
   } |  j |  n  |  j j | |  | r8|  j |  n  | rxK t |  j |  D]4 \ } }	 | j j |	 d  | j j	 |	 d  qQWn  d S(   u9  
        Save the current figure.

        Call signature::

          savefig(fname, dpi=None, facecolor='w', edgecolor='w',
                  orientation='portrait', papertype=None, format=None,
                  transparent=False, bbox_inches=None, pad_inches=0.1,
                  frameon=None)

        The output formats available depend on the backend being used.

        Parameters
        ----------

        fname : str or file-like object
            A string containing a path to a filename, or a Python
            file-like object, or possibly some backend-dependent object
            such as :class:`~matplotlib.backends.backend_pdf.PdfPages`.

            If *format* is *None* and *fname* is a string, the output
            format is deduced from the extension of the filename. If
            the filename has no extension, the value of the rc parameter
            ``savefig.format`` is used.

            If *fname* is not a string, remember to specify *format* to
            ensure that the correct backend is used.

        Other Parameters
        ----------------

        dpi : [ *None* | scalar > 0 | 'figure']
            The resolution in dots per inch.  If *None* it will default to
            the value ``savefig.dpi`` in the matplotlibrc file. If 'figure'
            it will set the dpi to be the value of the figure.

        facecolor : color spec or None, optional
            the facecolor of the figure; if None, defaults to savefig.facecolor

        edgecolor : color spec or None, optional
            the edgecolor of the figure; if None, defaults to savefig.edgecolor

        orientation : {'landscape', 'portrait'}
            not supported on all backends; currently only on postscript output

        papertype : str
            One of 'letter', 'legal', 'executive', 'ledger', 'a0' through
            'a10', 'b0' through 'b10'. Only supported for postscript
            output.

        format : str
            One of the file extensions supported by the active
            backend.  Most backends support png, pdf, ps, eps and svg.

        transparent : bool
            If *True*, the axes patches will all be transparent; the
            figure patch will also be transparent unless facecolor
            and/or edgecolor are specified via kwargs.
            This is useful, for example, for displaying
            a plot on top of a colored background on a web page.  The
            transparency of these patches will be restored to their
            original values upon exit of this function.

        frameon : bool
            If *True*, the figure patch will be colored, if *False*, the
            figure background will be transparent.  If not provided, the
            rcParam 'savefig.frameon' will be used.

        bbox_inches : str or `~matplotlib.transforms.Bbox`, optional
            Bbox in inches. Only the given portion of the figure is
            saved. If 'tight', try to figure out the tight bbox of
            the figure. If None, use savefig.bbox

        pad_inches : scalar, optional
            Amount of padding around the figure when bbox_inches is
            'tight'. If None, use savefig.pad_inches

        bbox_extra_artists : list of `~matplotlib.artist.Artist`, optional
            A list of extra artists that will be considered when the
            tight bbox is calculated.

        u   dpiu   savefig.dpiu   frameonu   savefig.frameonu   transparentu   savefig.transparentu	   facecoloru   noneu	   edgecoloru   savefig.facecoloru   savefig.edgecolori    i   N(   t
   setdefaultR   R   RI   R   R   R  R  R  R  R  R  R   t   print_figuret   zip(
   R    t   fnameR   R   t   transparentt   original_axes_colorsR   R   t   original_frameont   cc(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   savefig  s4    S		c   	      ` s   | d k r |  j   } n  |  j   } | d k r | rp t | t  rp |  j   rp t j | |  \ } } q t j | |  \ } } n  t | _	 d d d d d d g     f d   | j
   D } t j | | |  } |  j |  t |  _ | S(	   u   
        Create a colorbar for a ScalarMappable instance, *mappable*.

        Documentation for the pylab thin wrapper:
        %(colorbar_doc)s
        u   fractionu   padu   shrinku   aspectu   anchoru   panchorc         ` s+   i  |  ]! \ } } |   k r | |  q S(    (    (   R4   R(   R&  (   t   NON_COLORBAR_KEYS(    s0   lib/python2.7/site-packages/matplotlib/figure.pys
   <dictcomp>1  s   	 N(   R/   R  R:   R   R   t   cbart   make_axes_gridspect	   make_axesRQ   R   R$  t   colorbar_factoryR,  R   (	   R    t   mappableR  R   t   use_gridspect   kwt
   current_axt   cb_kwt   cb(    (   R  s0   lib/python2.7/site-packages/matplotlib/figure.pyt   colorbar  s     			c         O` s   |  j    r) |  j t  t j d  n  |  j j | |   x |  j D] } t | t	  s t | j
 t	  r | j
 j   | j | j
 j  q t | j t	  r | j j   | j | j j  q qF | j   | j | j  qF Wt |  _ d S(   u&  
        Call signature::

          subplots_adjust(left=None, bottom=None, right=None, top=None,
                              wspace=None, hspace=None)

        Update the :class:`SubplotParams` with *kwargs* (defaulting to rc when
        *None*) and update the subplot locations.

        u   This figure was using constrained_layout==True, but that is incompatible with subplots_adjust and or tight_layout: setting constrained_layout==False. N(   R   R   R   R@   RA   R   RS   RI   R:   R   t   _sharext   update_paramsR   t   figboxt   _shareyRQ   R   (   R    R   R   R   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR   8  s    
i   i   c         C` s7   t  |  d | d | d | } | d | d | d |  S(   u5  
        Blocking call to interact with a figure.

        Wait until the user clicks *n* times on the figure, and return the
        coordinates of each click in a list.

        The buttons used for the various actions (adding points, removing
        points, terminating the inputs) can be overridden via the
        arguments *mouse_add*, *mouse_pop* and *mouse_stop*, that give
        the associated mouse button: 1 for left, 2 for middle, 3 for
        right.

        Parameters
        ----------
        n : int, optional, default: 1
            Number of mouse clicks to accumulate. If negative, accumulate
            clicks until the input is terminated manually.
        timeout : scalar, optional, default: 30
            Number of seconds to wait before timing out. If zero or negative
            will never timeout.
        show_clicks : bool, optional, default: False
            If True, show a red cross at the location of each click.
        mouse_add : int, one of (1, 2, 3), optional, default: 1 (left click)
            Mouse button used to add points.
        mouse_pop : int, one of (1, 2, 3), optional, default: 3 (right click)
            Mouse button used to remove the most recently added point.
        mouse_stop : int, one of (1, 2, 3), optional, default: 2 (middle click)
            Mouse button used to stop input.

        Returns
        -------
        points : list of tuples
            A list of the clicked (x, y) coordinates.

        Notes
        -----
        The keyboard can also be used to select points in case your mouse
        does not have one or more of the buttons.  The delete and backspace
        keys act like right clicking (i.e., remove last point), the enter key
        terminates input and any other key (not already used by the window
        manager) selects a point.
        t	   mouse_addt	   mouse_popt
   mouse_stopt   nt   timeoutt   show_clicks(   R   (   R    R  R  R  R  R  R  t   blocking_mouse_input(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   ginputY  s    -		ic         C` s   t  |   } | d |  S(   u  
        Blocking call to interact with the figure.

        This will return True is a key was pressed, False if a mouse
        button was pressed and None if *timeout* was reached without
        either being pressed.

        If *timeout* is negative, does not timeout.
        R  (   R   (   R    R  t   blocking_input(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   waitforbuttonpress  s    c         C` su   g  |  j    D] } | j   r | ^ q } x3 |  j D]( } | j   r5 | j | j    q5 q5 W| j |  j  | S(   N(   R   Rh  RI   R   t   get_default_bbox_extra_artistsR8   R   (   R    R   t   bbox_artistsR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    c         C` s   g  } x6 |  j  D]+ } | j   r | j | j |   q q Wt |  d k rX |  j St j g  | D]* } | j d k s | j	 d k re | ^ qe  } t
 | t   j d |  j   } | S(   u   
        Return a (tight) bounding box of the figure in inches.

        It only accounts axes title, axis labels, and axis
        ticklabels. Needs improvement.
        i    g      ?(   RI   Rh  R   t   get_tightbboxRE   R}   R   t   unionRq   Rr   R   R   R~   R   (   R    Rq  t   bbR   R   t   _bboxR}   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR    s    @c         C` sP   |  j  d k rL t j d d d d d |   |  _  |  j  j d d d d  n  d S(   u7   Initialize the layoutbox for use in constrained_layout.R   R   u   figlbR   g        g      ?N(   R   R/   R   R   t   constrain_geometry(   R    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   init_layoutbox  s
    c   
      C` s   d d l  m } t j d  |  j d k r= t j d  d S|  j   \ } } } } |  } | j	   \ } }	 | | } | |	 } | d k r t
 j |  } n  | | | | | | |  d S(   u}   
        Use ``layoutbox`` to determine pos positions within axes.

        See also `.set_constrained_layout_pads`.
        i    (   t   do_constrained_layoutu   Executing constrainedlayoutu   Calling figure.constrained_layout, but figure not setup to do constrained layout.     You either called GridSpec without the fig keyword, you are using plt.subplot, or you need to call figure or subplotswith the constrained_layout=True kwarg.N(   t   matplotlib._constrained_layoutR  t   _logt   debugR   R/   R@   RA   R   R   R   R   (
   R    Rq  R  R   R   RX   RY   t   figRq   Rr   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyRk    s    

gHzG?c         C` s   d d l  m } m } m } | |  j  }	 d |	 k rG t j d  n  | d k rb | |   } n  | |  |  j |	 | d | d | d | d | }
 |  j |
   d S(	   u  
        Adjust subplot parameters to give specified padding.

        Parameters
        ----------
        pad : float
            padding between the figure edge and the edges of subplots,
            as a fraction of the font-size.

        h_pad, w_pad : float, optional
            padding (height/width) between edges of adjacent subplots.
            Defaults to `pad_inches`.

        rect : tuple (left, bottom, right, top), optional
            a rectangle (left, bottom, right, top) in the normalized
            figure coordinate that the whole subplots area (including
            labels) will fit into. Default is (0, 0, 1, 1).
        i   (   R   t   get_subplotspec_listt   get_tight_layout_figureuc   This figure includes Axes that are not compatible with tight_layout, so results might be incorrect.t   padR   R   R/  N(	   R   R   R  R  RI   R/   R@   RA   R   (   R    Rq  R  R   R   R/  R   R  R  t   subplotspec_listR   (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyR     s    c         C` s*  | d k r |  j } n  t j |  j   } x | D] } t j d | j    | j   } | j	   \ } } } } } }	 | j
 j   }
 x | D] } | j
 j   |
 k r | j   } | j	   \ } } } } } }	 |
 d k r | | k s|
 d k r| | k r|  j j | |  qq q Wq4 Wd S(   ut  
        Align the ylabels of subplots in the same subplot column if label
        alignment is being done automatically (i.e. the label position is
        not manually set).

        Alignment persists for draw events after this is called.

        If a label is on the bottom, it is aligned with labels on axes that
        also have their label on the bottom and that have the same
        bottom-most subplot row.  If the label is on the top,
        it is aligned with labels on axes with the same top-most row.

        Parameters
        ----------
        axs : list of `~matplotlib.axes.Axes`
            Optional list of (or ndarray) `~matplotlib.axes.Axes`
            to align the xlabels.
            Default is to align all axes on the figure.

        See Also
        --------
        matplotlib.figure.Figure.align_ylabels

        matplotlib.figure.Figure.align_labels

        Notes
        -----
        This assumes that ``axs`` are from the same `.GridSpec`, so that
        their `.SubplotSpec` positions correspond to figure positions.

        Examples
        --------
        Example with rotated xtick labels::

            fig, axs = plt.subplots(1, 2)
            for tick in axs[0].get_xticklabels():
                tick.set_rotation(55)
            axs[0].set_xlabel('XLabel 0')
            axs[1].set_xlabel('XLabel 1')
            fig.align_xlabels()

        u    Working on: %su   bottomu   topN(   R/   RI   Ry   t   asarrayt   ravelR  R  t
   get_xlabelt   get_subplotspect   get_rows_columnsR=  t   get_label_positionR   t   join(   R    t   axsR   t   ssRB  RC  t   row0t   row1t   col0t   col1t   labpot   axct   rowc0t   rowc1t   colc(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   align_xlabels	  s    ,c         C` sB  | d k r |  j } n  t j |  j   } x| D]} t j d | j    | j   } | j	   \ } } } } } }	 | g }
 | j
 j   } x | D] } | | k r | j
 j   | k r6| j   } | j	   \ } } } } } } | d k r| | k s| d k r3| |	 k r3|  j j | |  q3q6q q Wq4 Wd S(   uO  
        Align the ylabels of subplots in the same subplot column if label
        alignment is being done automatically (i.e. the label position is
        not manually set).

        Alignment persists for draw events after this is called.

        If a label is on the left, it is aligned with labels on axes that
        also have their label on the left and that have the same
        left-most subplot column.  If the label is on the right,
        it is aligned with labels on axes with the same right-most column.

        Parameters
        ----------
        axs : list of `~matplotlib.axes.Axes`
            Optional list (or ndarray) of `~matplotlib.axes.Axes`
            to align the ylabels.
            Default is to align all axes on the figure.

        See Also
        --------
        matplotlib.figure.Figure.align_xlabels

        matplotlib.figure.Figure.align_labels

        Notes
        -----
        This assumes that ``axs`` are from the same `.GridSpec`, so that
        their `.SubplotSpec` positions correspond to figure positions.

        Examples
        --------
        Example with large yticks labels::

            fig, axs = plt.subplots(2, 1)
            axs[0].plot(np.arange(0, 1000, 50))
            axs[0].set_ylabel('YLabel 0')
            axs[1].set_ylabel('YLabel 1')
            fig.align_ylabels()

        u    Working on: %su   leftu   rightN(   R/   RI   Ry   R  R  R  R  t
   get_ylabelR  R  R@  R  R   R  (   R    R  R   R  RB  RC  R  R  R  R  t   sameR  R  t   colc0t   colc1(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   align_ylabelsK	  s"    +	c         C` s$   |  j  d |  |  j d |  d S(   u  
        Align the xlabels and ylabels of subplots with the same subplots
        row or column (respectively) if label alignment is being
        done automatically (i.e. the label position is not manually set).

        Alignment persists for draw events after this is called.

        Parameters
        ----------
        axs : list of `~matplotlib.axes.Axes`
            Optional list (or ndarray) of `~matplotlib.axes.Axes`
            to align the labels.
            Default is to align all axes on the figure.

        See Also
        --------
        matplotlib.figure.Figure.align_xlabels

        matplotlib.figure.Figure.align_ylabels
        R  N(   R  R  (   R    R  (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   align_labels	  s    N(T   RM   RN   RO   Ri   Ro   R/   R$   t   propertyR0   t
   deprecatedR   R   RQ   R   R   RI   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R  R   R   R  R  R  R  R   R  R  R  R  R  R  R  R"  R+  R1  R4  RN  R.  R   R   R   Rl  Rr  R   R   t   dedent_interpdRz  R   R   R  R,  R  R  R  R  R  R  R   R  R  R  R  R  Rk  R   R  R  R  (    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyRe      s   		p!	'								$-				I	Y(														
		i	k	.	
		0			"	,		t	!3	
		$EEc   	      C` s   t  |  d  o t j |   } t j d	  } t j d
  } | rc |  j d  \ } } | | } n |  } t d d } t j | | | f  } | t d | |  } | t d | |  } t j | | |  } | S(   u>  
    Create a figure with specified aspect ratio.  If *arg* is a number,
    use that aspect ratio.  If *arg* is an array, figaspect will
    determine the width and height for a figure that would fit array
    preserving aspect ratio.  The figure width, height in inches are
    returned.  Be sure to create an axes with equal with and height,
    e.g.,

    Example usage::

      # make a figure twice as tall as it is wide
      w, h = figaspect(2.)
      fig = Figure(figsize=(w,h))
      ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
      ax.imshow(A, **kwargs)


      # make a figure with the proper aspect for an array
      A = rand(5,3)
      w, h = figaspect(A)
      fig = Figure(figsize=(w,h))
      ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
      ax.imshow(A, **kwargs)

    Thanks to Fernando Perez for this function
    u   shapeg      @g       @g      0@i   u   figure.figsizei   g      ?(   g      @g       @(   g      0@g      0@(	   R   Ry   t   isscalarR  R   R   t   minR  t   clip(	   t   argt   isarrayt   figsize_mint   figsize_maxt   nrt   nct	   arr_ratiot
   fig_heightt   newsize(    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt	   figaspect	  s    (J   RO   t
   __future__R    R   R   R   R)  t   loggingR@   t   numpyRy   R  R   R   R   R  t   matplotlib.artistR   t   martistR   R   t   matplotlib.cbookR0   R	   R
   R   Rm  t   matplotlib.imageR   t   matplotlib.colorbarR  R  t   matplotlib.axesR   R   R   t   matplotlib.blocking_inputR   R   t   matplotlib.gridspecR   t   matplotlib.legendRz  Rs  t   matplotlib.patchesR   t   matplotlib.projectionsR   R   t   matplotlib.textR   R   t   matplotlib.transformsR   R   R   R   t   matplotlib._layoutboxR   R   t   matplotlib.backend_basesR   t	   getLoggerRM   R  t   interpdRS   R"   R#   R?   RP   Re   R  t   kwdoc(    (    (    s0   lib/python2.7/site-packages/matplotlib/figure.pyt   <module>   sR   ""	mQ        	;