
 m[c           @` s  d  Z  d d l m Z m Z m Z m Z d d l Z d d l m Z d d l	 Z	 d d l
 Z d d l Z d d l m Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j Z d d l j  Z  d d l! j" Z" d d l# j$ Z$ d d l% j& Z' d d l( j) Z) d d l* j+ Z, d d l- m. Z. d e  j/ f d     YZ0 d	 e1 f d
     YZ2 d   Z3 d   Z4 d   Z5 d e j6 e2 f d     YZ7 d e7 f d     YZ8 d S(   uQ   
These are classes to support contour plotting and labelling for the Axes class.
i    (   t   absolute_importt   divisiont   print_functiont   unicode_literalsN(   t   xrange(   t   ma(   t   BlockingContourLabelert
   ClabelTextc           B` s   e  Z d  Z d   Z RS(   u   
    Unlike the ordinary text, the get_rotation returns an updated
    angle in the pixel coordinate assuming that the input rotation is
    an angle in data coordinate (or whatever transform set).
    c         C` sh   t  j j |   } |  j   } |  j   \ } } | j t j | g  t j | | g g   } | d S(   Ni    (   t   textt   Textt   get_rotationt   get_transformt   get_positiont   transform_anglest   npt   array(   t   selft   anglet   transt   xt   yt
   new_angles(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR
   -   s    (   t   __name__t
   __module__t   __doc__R
   (    (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR   '   s   t   ContourLabelerc           B` s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z e j	 d  d    Z
 d   Z d	   Z d
   Z d d d  Z d   Z d   Z d   Z d   Z d   Z e d d d  Z d d  Z d   Z RS(   u7   Mixin to provide labelling capability to `.ContourSet`.c         O` se  | j  d d  } | j  d d  } | j  d d  } | j  d d  |  _ | j  d d  } | j  d	 t  |  _ | j  d
 t  |  _ | j  d t  |  _ t |  d k r |  j	 } t
 t t |  j    } n t |  d k rt
 | d  }	 g  g  } } xF t |  j	  D]5 \ }
 } | |	 k r| j |
  | j |  qqWt |  t |	  k  rt d j |	 |  j	    qn t d   | |  _ | |  _ t j   |  _ |  j j |  |  j j   } | g t |  |  _ | d k r|  |  _ t j |  j |  j  |  _ n] t j | d t |  j  } t
 t t |  j    |  _ t  j! d | d t j"    |  _ g  |  _# t$ j% |  j  rx |  j D]" \ } } |  j& | | | |  qWn\ |  j rt' d  t' d  | st' d  n  t( |   } | | |  n |  j) | |  |  j* |  _+ |  j# |  _, |  j- |  _. t$ j/ d |  j*  |  _0 |  j0 S(   u  
        Label a contour plot.

        Call signature::

          clabel(cs, **kwargs)

        Adds labels to line contours in *cs*, where *cs* is a
        :class:`~matplotlib.contour.ContourSet` object returned by
        contour.

        ::

          clabel(cs, v, **kwargs)

        only labels contours listed in *v*.

        Parameters
        ----------
        fontsize : string or float, optional
            Size in points or relative size e.g., 'smaller', 'x-large'.
            See `Text.set_size` for accepted string values.

        colors :
            Color of each label

            - if *None*, the color of each label matches the color of
              the corresponding contour

            - if one string color, e.g., *colors* = 'r' or *colors* =
              'red', all labels will be plotted in this color

            - if a tuple of matplotlib color args (string, float, rgb, etc),
              different labels will be plotted in different colors in the order
              specified

        inline : bool, optional
            If ``True`` the underlying contour is removed where the label is
            placed. Default is ``True``.

        inline_spacing : float, optional
            Space in pixels to leave on each side of label when
            placing inline. Defaults to 5.

            This spacing will be exact for labels at locations where the
            contour is straight, less so for labels on curved contours.

        fmt : string or dict, optional
            A format string for the label. Default is '%1.3f'

            Alternatively, this can be a dictionary matching contour
            levels with arbitrary strings to use for each contour level
            (i.e., fmt[level]=string), or it can be any callable, such
            as a :class:`~matplotlib.ticker.Formatter` instance, that
            returns a string when called with a numeric contour level.

        manual : bool or iterable, optional
            If ``True``, contour labels will be placed manually using
            mouse clicks. Click the first button near a contour to
            add a label, click the second button (or potentially both
            mouse buttons at once) to finish adding labels. The third
            button can be used to remove the last label added, but
            only if labels are not inline. Alternatively, the keyboard
            can be used to select label locations (enter to end label
            placement, delete or backspace act like the third mouse button,
            and any other key will select a label location).

            *manual* can also be an iterable object of x,y tuples.
            Contour labels will be created as if mouse is clicked at each
            x,y positions.

        rightside_up : bool, optional
            If ``True``, label rotations will always be plus
            or minus 90 degrees from level. Default is ``True``.

        use_clabeltext : bool, optional
            If ``True``, `ClabelText` class (instead of `Text`) is used to
            create labels. `ClabelText` recalculates rotation angles
            of texts during the drawing time, therefore this can be used if
            aspect of the axes changes. Default is ``False``.
        u   fontsizeu   inlinei   u   inline_spacingi   u   fmtu   %1.3fu   colorsu   use_clabeltextu   manualu   rightside_upi    u3   Specified levels {} don't match available levels {}u-   Illegal arguments to clabel, see help(clabel)t   Nt   cmapt   normu9   Select label locations manually using first mouse button.u.   End manual selection with second mouse button.u1   Remove last label by clicking third mouse button.u	   text.TextN(1   t   gett   Nonet   labelFmtt   Falset   _use_clabeltextt   labelManualt   Truet   rightside_upt   lent   levelst   listR   t   cvaluest	   enumeratet   appendt
   ValueErrort   formatt	   TypeErrort   labelLevelListt   labelIndiceListt   font_managert   FontPropertiest   labelFontPropst   set_sizet   get_size_in_pointst   labelFontSizeListt   labelMappableR   t   taket   labelCValueListt   colorst   ListedColormapt   cmt   ScalarMappablet   NoNormt   labelXYst   cbookt   iterablet   add_label_neart   printR   t   labelst
   labelTextst   clt   cl_xyt   labelCValuest
   cl_cvaluest   silent_listt   labelTextsList(   R   t   argst   kwargst   fontsizet   inlinet   inline_spacingt   _colorsR&   t   indicest   levlabst   it   levt   font_size_ptsR   R   R   t   blocking_contour_labeler(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   clabel9   sj    `							

c         C` s9   t  |  d | k p8 t j | d d d | k j   S(   u5   Return *False* if contours are too short for a label.i
   t   axisi    g333333?(   R%   R   t   ptpt   any(   R   t   linecontourt
   labelwidth(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   print_label   s    c         C` sW   xP |  j  D]E } t j | | d d | | d d  } | d | k  r
 t Sq
 Wt S(   u7   Return *True* if a label is already near this location.i    i   i   g333333?(   R>   R   t   sqrtR#   R    (   R   R   R   t   lwt   loct   d(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt	   too_close   s
    +c         C` s   t  | d  } t j |  } xP | D]H } | | | | | | }	 }
 |  j |	 |
 |  rd q& n  |	 |
 | f SW| d } | | | | | | }	 }
 |	 |
 | f S(   u  
        Return x, y, and the index of a label location.

        Labels are plotted at a location with the smallest
        deviation of the contour from a straight line
        unless there is another label nearby, in which case
        the next best place on the contour is picked up.
        If all such candidates are rejected, the beginning
        of the contour is chosen.
        i   i    (   t   intR   t   argsortRb   (   R   t	   distancest   XXt   YYt   ysizeR_   t   hysizet   adistt   indR   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   get_label_coords   s    
c         C` s  t  | t j  s' |  j | |  } n  t j j |  \ } } | d k r t |  d  sl t j	   |  _
 n  |  j
 j | |  \ } } } nt | r t |  d  s t j d  |  _ n  |  j j | d d d |  j \ } } | j   } n t |  | d } | S(	   u:   
        Return the width of the label in points.
        u   TeXu   _TeX_manageru   _mathtext_parseru   bitmapt   dpiiH   t   propg333333?(   t
   isinstancet   sixt   string_typest   get_textR   R	   t   is_math_textt   hasattrt
   texmanagert
   TexManagert   _TeX_managert   get_text_width_height_descentt   mathtextt   MathTextParsert   _mathtext_parsert   parseR2   t	   get_widthR%   (   R   RT   t   fmtt   fsizet   ismathR_   t   _t   img(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   get_label_width  s     u   2.2c         C` s   t  j t  j |  j j    j d d  d d } t j | d | d  } |  j | |  j	 | |  d  | j
 d |  j j j j  } t  j | j   d d d  d f  d } | S(   u  
        This computes actual onscreen label width.
        This uses some black magic to determine onscreen extent of non-drawn
        label.  This magic may not be very robust.

        This method is not being used, and may be modified or removed.
        i   RX   i   i    u   kt   rendererN(   R   t   meant   asarrayt   axRX   t   reshapeR   R	   t   set_label_propsRr   t   get_window_extentt   figuret   canvasR   t   difft   corners(   R   RT   R~   R   t   xxt   tt   bboxR_   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   get_real_label_width  s    
3,c         C` sA   | j  |  | j |  | j |  j  | j |  j j  d S(   u1   Set the label properties - color, fontsize, text.N(   t   set_textt	   set_colort   set_fontpropertiesR2   t   set_clip_boxR   R   (   R   t   labelR   t   color(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR   :  s    c         C` sW   t  | t j  r | St  | t  r5 | j | d  St |  rK | |  S| | Sd S(   u   Get the text of the label.u   %1.3fN(   Ro   Rp   Rq   t   dictR   t   callable(   R   RT   R~   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRr   A  s    
c         C` s  t  |  } | d k r4 t t j | |   } n d } | d k rO | } n t |  } t j | d d  d f | | f  } t j | d d  d f | | f  } | d d  d d  f } | d d  d d  f }	 | d d  d d  f }
 | d d  d d  f } | | | |
 |
 | |	 | } t j | |
 |	 |  } t j d d d d  ' t j t j |  | d d } Wd QX|  j	 | | | | |  \ } } } g  | D] } t
 |  ^ q} | j | | f  } | | | f S(	   uX   
        Find good place to draw a label (relatively flat part of the contour).
        i   Ni    it   divideu   ignoret   invalidRX   (   R%   Rc   R   t   ceilt   resizet   hypott   errstatet   sumt   absRl   t   tuplet   index(   R   R[   R\   t   nsizet   xsizeRh   Rf   Rg   t   yfirstt   ylastt   xfirstt   xlastt   st   Lt   distR   R   Rk   t   lt   lct   dind(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   locate_labelM  s*    	(("($i   c         ` s  | d k r g  } n  | d } t |  } | r t j | | d !| | d  f } t |  r t j | | d !| | d  f } n  d } n  t j | j d d t  t j | d d } t j	 t j
 | d d  d f | d d  d f    d )  |  t j | | g   | rCt j  d d g    n t j         f d   | j D \ \ } \ }	 t j t j |	 |   }
 |  j r|
 d	 d
 d	 }
 n  g  } t |  r   t j | | g   t j   t j t    d d d d } t j | d  j t  t j | d  j t  g } | d d k rg  | j D] } t j  d  |  ^ qh} n  | d d k rg  | j D] } t j  d  |  ^ q} n  | r&t d   | D  r| j t j | | | d | d d !| g   qq| d d k ra| j t j | | d d  | g   n  | d d k r| j t j | | | d g   qn  |
 | f S(   u  
        This function calculates the appropriate label rotation given
        the linecontour coordinates in screen units, the index of the
        label location and the label width.

        It will also break contour and calculate inlining if *lc* is
        not empty (lc defaults to the empty list if None).  *spacing*
        is the space around the label in pixels to leave empty.

        Do both of these tasks at once to avoid calculating path lengths
        multiple times, which is relatively costly.

        The method used here involves calculating the path length
        along the contour in pixel coordinates and then looking
        approximately label width / 2 away from central point to
        determine rotation and then to break contour if desired.
        g       @ii   i    t   dtypeRX   Nc         3` s1   |  ]' } t  j t  j     |   Vq d  S(   N(   R   R   t   interp(   t   .0t   slc_col(   t   dpt   plt   xi(    s1   lib/python2.7/site-packages/matplotlib/contour.pys	   <genexpr>  s   iZ   i   t   leftt   rightc         s` s   |  ] } | d  k Vq d S(   iN(    (   R   RS   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pys	   <genexpr>  s    (   R   t   _is_closed_polygonR   t   r_R%   t   zerost   shapet   floatR   t   cumsumR   R   t
   zeros_liket   Tt   rad2degt   arctan2R$   R   t   aranget   floort   astypeRc   R   t   allR*   t	   row_stack(   R   t   slcRk   R_   R   t   spacingt   hlwt   closedt   dxt   dyt   rotationt   nlct   It   lc_colt   xy1t   xy2(    (   R   R   R   s1   lib/python2.7/site-packages/matplotlib/contour.pyt   calc_label_rot_and_inlineq  sN    	
"%	?	08228+*c      	   C` sO   |  j  j j   j | | f  \ } } t j | | d | d d d d } | S(   NR   t   horizontalalignmentu   centert   verticalalignment(   R   t	   transDatat   invertedt   transform_pointR   R	   (   R   R   R   R   R   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _get_label_text  s
    '	c   	   	   C` s   |  j  j j   } | j | | f  \ } } | j t j | g  t j | | g g   } t | | d | d d d d d } | S(   NR   i    R   u   centerR   (   R   R   R   R   R   R   R   R   (	   R   R   R   R   t   transDataInvR   R   t	   drotationR   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _get_label_clabeltext  s    	c         C` s   |  j  j | d |  j } |  j | |  j  } |  j | | |  |  j j |  |  j j |  |  j	 j | | f  |  j
 j |  d  S(   Nt   alpha(   R6   t   to_rgbaR   Rr   R   R   RD   R*   RG   R>   R   t
   add_artist(   R   R   R   R   RT   t   cvalueR   t   _text(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt
   _add_label  s    c         C` s2   |  j  | | |  } |  j | | | | |  d S(   uO   
        Add contour label using :class:`~matplotlib.text.Text` class.
        N(   R   R   (   R   R   R   R   RT   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt	   add_label  s    c         C` s2   |  j  | | |  } |  j | | | | |  d S(   uD   
        Add contour label using :class:`ClabelText` class.
        N(   R   R   (   R   R   R   R   RT   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   add_label_clabeltext  s    	c         C` sK  | d k r |  j j } n  | r? | j | | f  \ } } n  |  j | | |  j  d  \ } } } }	 }
 |  j | j   } | | } | j } |  j j j	   j |	 |
 g  } t
 j | | |  st
 j | |  t
 j |  d d d  f | | f } t j |  | | <n  |  j j |  } |  j | j   } | | j } |  j j j |  } |  j |  j | |  j |  j |  } | |  j j j d 9} | r| } n d } |  j | | | | |  \ } } |  j |	 |
 | |  j | |  j |  | rG| j |  x< | D]1 } t |  d k r| j t j |   qqWn  d S(   u)  
        Add a label near the point (x, y). If transform is None
        (default), (x, y) is in data coordinates; if transform is
        False, (x, y) is in display coordinates; otherwise, the
        specified transform will be used to translate (x, y) into
        display coordinates.

        Parameters
        ----------
        x, y : float
            The approximate location of the label.

        inline : bool, optional, default: True
            If *True* remove the segment of the contour beneath the label.

        inline_spacing : int, optional, default: 5
            Space in pixels to leave on each side of label when placing
            inline. This spacing will be exact for labels at locations where
            the contour is straight, less so for labels on curved contours.
        i   Ng      R@i   (   R   R   R   R   t   find_nearest_contourR/   t   collectionst	   get_pathst   verticesR   R   t   allcloseR   R   t   mpatht   PathR   t	   transformR   R.   R   R5   R   Rm   R   R   R8   t   popR%   R*   (   R   R   R   RN   RO   R   t   conmint   segmint   imint   xmint   ymint   pathst   active_pathR   t   xcmint   lminR   R_   t   lcargR   R   t   n(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRA     sB    %
	!7	ic         C` s0   |  j  j |  |  j j |  } | j   d S(   u>   Defaults to removing last label, but any index can be suppliedN(   RG   R   RD   t   remove(   R   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt	   pop_label[  s    c         C` s  |  j  r |  j } n	 |  j } xt |  j |  j |  j |  j  D]\ } } } } |  j | } | j	   }	 |  j
 | |  j |  }
 |
 |  j j j d 9}
 g  } | j   } x>t |  D]0\ } } | j } |	 j |  } t |  rt j | | d d  d  d   f f } n | } |  j | |
  r|  j | |
  \ } } } | rW| } n d  } |  j | | |
 | |  \ } } | | | | | |  | rx< | D]1 } t |  d k r| j t j |   qqWqq | j |  q W| r@ | 2| j |  q@ q@ Wd  S(   Ng      R@i   i   (   R!   R   R   t   zipR/   R.   R5   R8   R   R   R   R   R   R   Rm   R   R)   R   R   R   R   R   R]   R   R   R   R%   R*   R   R   t   extend(   R   RN   RO   R   t   iconRT   R   R   t   conR   R_   t	   additionsR   t   segNumt   linepathR   t   slc0R   R   R   Rk   R   R   t   newR   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRC   a  sF    		"	,	#N(   R   R   R   RW   R]   Rb   Rl   R   R?   t
   deprecatedR   R   Rr   R   R   R   R   R   R   R   R   R#   RA   R   RC   (    (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR   6   s(   								$[					Xc         C` s   t  j | |  k  r6 t  j | |  d  } | |  f S| |  } | |  } t  j | |  t  j | |  } | d k  r d } n  | d k r d } n  |  | | } t  j | | d  } | | f S(   uB   Find the closest point to p0 on line segment connecting p1 and p2.i   i    i   (   R   R   R   t   dot(   t   p1t   p2t   p0Ra   t   d21t   d01t   projt   pc(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _find_closest_point_on_leg  s    


"		c         C` s   t  j |  d |  d k  S(   u   
    Return whether first and last object in a sequence are the same. These are
    presumably coordinates on a polygonal curve, in which case this function
    tests if that curve is closed.
    i    i(   R   R   (   t   X(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR     s    c         C` s=  t  j |  | d d d  f d d  } t  j |  } t  j } d } d } t |   } g  } | d k sr | r | j | d t |   | f  n  | t |   d k  s | r | j | | d t |   f  n  xW | D]O }	 t |  |	 d |  |	 d |  \ }
 } |
 | k  r |
 } | } |	 } q q W| | | f S(   uJ   
    lc: coordinates of vertices
    point: coordinates of test point
    Ni   i   i    (   NN(	   R   R   R   t   argmint   infR   R*   R%   R  (   R   t   pointt   dsR   t   dminR   t   legminR   t   legst   legRa   t   xc(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _find_closest_point_on_path  s$    *	$$(t
   ContourSetc           B` s   e  Z d  Z d   Z d   Z d   Z d e d  Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d e d  Z RS(   u  
    Store a set of contour lines or filled regions.

    User-callable method: `~.axes.Axes.clabel`

    Parameters
    ----------
    ax : `~.axes.Axes`

    levels : [level0, level1, ..., leveln]
        A list of floating point numbers indicating the contour
        levels.

    allsegs : [level0segs, level1segs, ...]
        List of all the polygon segments for all the *levels*.
        For contour lines ``len(allsegs) == len(levels)``, and for
        filled contour regions ``len(allsegs) = len(levels)-1``. The lists
        should look like::

            level0segs = [polygon0, polygon1, ...]
            polygon0 = array_like [[x0,y0], [x1,y1], ...]

    allkinds : ``None`` or [level0kinds, level1kinds, ...]
        Optional list of all the polygon vertex kinds (code types), as
        described and used in Path. This is used to allow multiply-
        connected paths such as holes within filled polygons.
        If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
        should look like::

            level0kinds = [polygon0kinds, ...]
            polygon0kinds = [vertexcode0, vertexcode1, ...]

        If *allkinds* is not ``None``, usually all polygons for a
        particular contour level are grouped together so that
        ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.

    kwargs :
        Keyword arguments are as described in the docstring of
        `~.axes.Axes.contour`.

    Attributes
    ----------
    ax:
        The axes object in which the contours are drawn.

    collections:
        A silent_list of LineCollections or PolyCollections.

    levels:
        Contour levels.

    layers:
        Same as levels for line contours; half-way between
        levels for filled contours.  See :meth:`_process_colors`.
    c         O` s  | |  _  | j d d6  |  _ | j d t  |  _ | j d d6  |  _ | j d d6  |  _ | j d d6 g  |  _ | j d d6  |  _	 | j d d6  |  _
 | j d d6  |  _ | j d	 d6  } | j d
 d6  |  _ | j d d6  } | j d d6  } | j d d6  } | j d d  |  _ | j d d6  |  _ |  j d6 k r_|  j r_t |  _ n  | j d d  |  _ | j d d6  |  _ t | t j  st |  j t j  rt |  _ | d6 k rt j   } n  |  j d k	 rt d   qn	 t |  _ |  j
 d7 k rt d   n  |  j d6 k	 rOt |  j  d k rOt d   n  |  j d6 k	 ry| d6 k	 ryt d   n  |  j
 d k rt j d |  _
 n  | j d d6  |  _ |  j | |   } |  j   |  j d6 k	 rt |  j  } |  j r | d 8} n  d }	 |  j d8 k }
 |  j d9 k } t } | t |
  t |  } t |  j  | k rt |
 | g  rt } |
 rd }	 qn  t j  |  j |	 d6 !d" | } | r|
 r| j! |  j d  n  | r| j" |  j d#  qqn  |  j rt# j$ d$  |  _% n t# j$ d%  |  _% g  |  _& g  |  _' i | d	 6} | d6 k	 rP| | d <n  t( j) j* |  |  | d6 k	 r~| |  j+ _, n  | d6 k	 r| |  j+ _- n  |  j.   |  j/   \ |  _0 |  _1 |  j r|  j d6 k	 rt2 j3 d&  n  |  j4   \ } } |  j1 d6 k r d6 g t |  j0  |  _1 n  | j d' d  } xt5 | | |  j0 |  j1  D] \ } } } } |  j6 | |  } t7 j8 | d( |  j f d) d* d+ |  j	 d, |  j9   d- | } |  j  j: | d. t |  j% j; |  qNWn |  j<   } | |  _= |  j>   } |  j } | d6 k	 r |  j f } n  | j d' d/  } x t5 |  j | | |  j0  D] \ } } } } t7 j? | d( | d0 | d1 | g d+ |  j	 d, |  j9   d- | } | j@ d2  |  j  j: | d. t |  j% j; |  qNWxS |  j% D]H } |  jA d |  jB d g | jC jD (|  jA d |  jB d g | jC jE (qW|  j  jF |  jA |  jB g  |  j  jG d3 t  |  jH   | rd4 jI tJ tK |   } t2 j3 d5 |  n  d6 S(:   u  
        Draw contour lines or filled regions, depending on
        whether keyword arg *filled* is ``False`` (default) or ``True``.

        Call signature::

            ContourSet(ax, levels, allsegs, [allkinds], **kwargs)

        Parameters
        ----------
        ax :
            The `~.axes.Axes` object to draw on.

        levels : [level0, level1, ..., leveln]
            A list of floating point numbers indicating the contour
            levels.

        allsegs : [level0segs, level1segs, ...]
            List of all the polygon segments for all the *levels*.
            For contour lines ``len(allsegs) == len(levels)``, and for
            filled contour regions ``len(allsegs) = len(levels)-1``. The lists
            should look like::

                level0segs = [polygon0, polygon1, ...]
                polygon0 = array_like [[x0,y0], [x1,y1], ...]

        allkinds : [level0kinds, level1kinds, ...], optional
            Optional list of all the polygon vertex kinds (code types), as
            described and used in Path. This is used to allow multiply-
            connected paths such as holes within filled polygons.
            If not ``None``, ``len(allkinds) == len(allsegs)``. The lists
            should look like::

                level0kinds = [polygon0kinds, ...]
                polygon0kinds = [vertexcode0, vertexcode1, ...]

            If *allkinds* is not ``None``, usually all polygons for a
            particular contour level are grouped together so that
            ``level0segs = [polygon0]`` and ``level0kinds = [polygon0kinds]``.

        **kwargs
            Keyword arguments are as described in the docstring of
            `~axes.Axes.contour`.
        u   levelsu   filledu
   linewidthsu
   linestylesu   hatchesu   alphau   originu   extentu   cmapu   colorsu   normu   vminu   vmaxu   extendu   neitheru   antialiasedu   nchunki    u   locatoru.   extend kwarg does not work yet with log  scaleu   loweru   upperu   imageu@   If given, *origin* must be one of [ 'lower' | 'upper' | 'image']i   u7   If given, *extent* must be '[ *None* | (x0,x1,y0,y1) ]'u"   Either colors or cmap must be Noneu   image.originu	   transformi   u   minu   bothu   maxR   iu   mcoll.PathCollectionu   mcoll.LineCollectionu!   linewidths is ignored by contourfu   zordert   antialiasedst
   edgecolorsu   noneR   R   t   zordert   autolimi   t
   linewidthst
   linestylesu
   _nolegend_t   tightu   , u/   The following kwargs were not used by contour: N(   Nu   loweru   upperu   image(   u   minu   both(   u   maxu   both(L   R   R   R   R&   R    t   filledR!  R"  t   hatchesR   t   origint   extentR9   R   t   antialiasedt   nchunkt   locatorRo   t   LogNormt   tickert
   LogLocatorR#   t   logscaleR+   R%   t   mplt   rcParamst
   _transformt   _process_argst   _process_levelsRc   RZ   R:   t	   set_undert   set_overR?   RI   R   RD   RG   R;   R<   t   __init__R   t   vmint   vmaxt   _process_colorst   _get_allsegs_and_allkindst   allsegst   allkindst   warningst   warnt   _get_lowers_and_uppersR   t   _make_pathst   mcollt   PathCollectionR   t   add_collectionR*   t   _process_linewidthst   tlinewidthst   _process_linestylest   LineCollectiont	   set_labelt   _minst   _maxst   sticky_edgesR   R   t   update_datalimt   autoscale_viewt   changedt   joint   mapt   repr(   R   R   RK   RL   R   R   R7  R8  t   ncolorst   i0t
   extend_mint
   extend_maxt   use_set_under_overt   total_levelst   kwt   lowerst   uppersR  t   levelt   level_uppert   segst   kindsR   t   colRE  t   tlinestylest   aat   widtht   lstyleR   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR6    s    -			$
				
	+				+			!%
	c         C` sk   |  j  d k r! |  j j |  _  nC t |  j  t j  rd t |  j  d  rd |  j  j |  j  |  _  n  |  j  S(   up   
        Return the :class:`~matplotlib.transforms.Transform`
        instance used by this ContourSet.
        u   _as_mpl_transformN(	   R1  R   R   R   Ro   t   mtransformst	   TransformRt   t   _as_mpl_transform(   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR     s    c         C` s   |  j  j   } d  | d <| S(   Nu   _contour_generator(   t   __dict__t   copyR   (   R   t   state(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   __getstate__  s    
u   xc         C` s  g  } g  } |  j  rX|  j   \ } } t |  j  } xt t |  j | |   D] \ } \ }	 }
 } t j d d d d |	 j   d d |	 j	   d |	 j
   } | j |  | |
  }
 | |  } | d k r |  j d k r | j d | |
 f  qR | | d k r7|  j d k r7| j d
 | | f  qR | j d |
 | | f  qR Wnr xo t |  j |  j  D]X \ }	 } t j d  } | j |	  | j |  | |  } | j d | | f  qnW| | f S(   u  
        Return a list of artists and labels suitable for passing through
        to :func:`plt.legend` which represent this ContourSet.

        The labels have the form "0 < x <= 1" stating the data ranges which
        the artists represent.

        Parameters
        ----------
        variable_name : str
            The string used inside the inequality used on the labels.

        str_format : function: float -> str
            Function used to format the numbers in the labels.

        Returns
        -------
        artists : List[`.Artist`]
            A list of the artists.

        labels : List[str]
            A list of the labels.

        i    i   t	   facecolort   hatchR   u   minu   bothu   $%s \leq %s$u   maxu	   $%s > %s$u   $%s < %s \leq %s$u	   $%s = %s$(   i    i    (   u   minu   both(   u   maxu   bothN(   R$  R?  R%   R   R)   R   t   mpatchest	   Rectanglet   get_facecolort	   get_hatcht	   get_alphaR*   R   R&   RA  RG  R   t   update_from(   R   t   variable_namet
   str_formatt   artistsRC   RY  RZ  t   n_levelsRS   t
   collectiont   lowert   uppert   patchR[  (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   legend_elements  s>    	+"c         O` s  | d |  _  | d |  _ t |  d k r6 | d p9 d |  _ t j |  j   |  _ t j |  j   |  _	 t
 |  _ |  j r t |  j  t |  j   d k r t d   q n- t |  j  t |  j   k r t d   n  |  j d k	 rt |  j  t |  j  k rt d   n  g  |  j D] } | D] } | ^ q,q"} t j | d d } | j d d  |  _ | j d d  |  _ | S(	   u   
        Process *args* and *kwargs*; override in derived classes.

        Must set self.levels, self.zmin and self.zmax, and update axes
        limits.
        i    i   i   u-   must be one less number of segments as levelsu)   must be same number of segments as levelsu(   allkinds has different length to allsegsRX   N(   R&   R;  R%   R   R<  R   t   maxt   zmaxt   mint   zminR    t   _autoR$  R+   t   concatenateRI  RJ  (   R   RK   RL   t   segR   t   flatseglistt   points(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR2  E  s&    %		")c         C` s   |  j  |  j f S(   uv   
        Override in derived classes to create and return allsegs and allkinds.
        allkinds can be None.
        (   R;  R<  (   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR:  i  s    c         C` ss   |  j  d  } |  j | d k r\ | j   } |  j rI d |  j | d <q\ | d c d 8<n  |  j  d } | | f S(   u=   
        Return (lowers,uppers) for filled contours.
        ii    gGz?i   (   t   _levelsR  Rh  R.  (   R   RY  RZ  (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR?  p  s    	c         C` se   | d  k	 rA g  t | |  D]! \ } } t j | d | ^ q Sg  | D] } t j |  ^ qH Sd  S(   Nt   codes(   R   R   R   R   (   R   R]  R^  R  t   kind(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR@    s    2c   	      C` s  g  |  j  |  j d |  j D] } t |  f ^ q } | |  _ |  j t |  } xY t | | |  j  D]B \ } } } |  j	 r | j
 |  | j |  qi | j |  qi WxL t |  j |  j  D]5 \ } } | j |  j  | j |  j j  |   q Wt j j |   d  S(   NR   (   R   R(   R   R   t   tcolorsR%  R%   R   R   R$  t   set_facecolort	   set_hatchR   RD   RG   t	   set_alphaR6   R;   R<   RN  (	   R   t   rgbaR  R%  R   Rl  Rw  R   t   cv(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRN    s    4		"c         C` sq   |  j  d k rI |  j r* t j   |  _  qI t j | d d d |  _  n  |  j  j |  j |  j  } t	 |  _
 | S(   u  
        Select contour levels to span the data.

        We need two more levels for filled contours than for
        line contours, because for the latter we need to specify
        the lower and upper boundary of each range. For example,
        a single contour boundary, say at z = 0, requires only
        one contour line, but two filled regions, and therefore
        three levels to provide boundaries for both regions.
        i   t   min_n_ticksN(   R*  R   R.  R,  R-  t   MaxNLocatort   tick_valuesR  R}  R#   R  (   R   R   RT   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _autolev  s    		c         C` s  |  j  r d } n d } t |  _ |  j d k r t |  d k rT |  j d  } nl | d } yC t |  t k r |  j |  } n t	 j
 |  j t	 j  } Wn t d j |    n X| |  _ n! t	 j
 |  j  j t	 j  |  _ |  j  s_|  j |  j k |  j |  j k  @} |  j | |  _ t |  j  d k r_|  j g |  _ t j d  q_n  |  j  rt |  j  d k  rt d   n  t |  j  d	 k rt	 j t	 j |  j   d
 k rt d   n  d S(   uH   
        Determine the contour levels and store in self.levels.
        u   contourfu   contouri    i   u,   Last {0} arg must give levels; see help({0})u3   No contour levels were found within the data range.i   u*   Filled contours require at least 2 levels.i   g        u!   Contour levels must be increasingN(   R$  R    R  R&   R   R%   R  t   typeRc   R   R   R   t   float64R-   R,   R  R}  R=  R>  R+   R~  R   (   R   t   zRK   t   fnRT   t	   level_argt   inside(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   _contour_level_args  s8    			
!	"6c         C` s  t  |  j  |  _ |  j d k rN |  j j d t |  j d |  j  d  n  |  j d k r |  j j t |  j d |  j	  d  n  t
 j |  j  |  _ |  j s |  j |  _ d Sd |  j d  |  j d |  _ |  j d k r d	 |  j d <n  |  j d k rd
 |  j d <n  d S(   u&  
        Assign values to :attr:`layers` based on :attr:`levels`,
        adding extended layers as needed if contours are filled.

        For line contours, layers simply coincide with levels;
        a line is a thin layer.  No extended levels are needed
        with line contours.
        u   bothu   mini    i   u   maxiNg      ?gP.5gP.5_(   u   bothu   min(   u   bothu   max(   u   bothu   min(   u   bothu   max(   R'   R&   R  R   t   insertR~  R  R*   R|  R}  R   R   R$  t   layers(   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR3    s    -*	c         C` s   |  j  j |  _ |  j d k	 r d t |  j  } } |  j r | d 8} |  j d k rc | d 8} n  |  j d k r | d 7} q n  t t	 | |   |  _
 |  j t j    n |  j |  _
 |  j |  j  |  j   |  j d	 k r t |  j _ n  d S(
   u  
        Color argument processing for contouring.

        Note that we base the color mapping on the contour levels
        and layers, not on the actual range of the Z values.  This
        means we don't have to worry about bad values in Z, and we
        always have the full dynamic range available for the selected
        levels.

        The color is based on the midpoint of the layer, except for
        extended end layers.  By default, the norm vmin and vmax
        are the extreme values of the non-extended levels.  Hence,
        the layer color extremes are not the extreme values of
        the colormap itself, but approach those values as the number
        of levels increases.  An advantage of this scheme is that
        line contours, when added to filled contours, take on
        colors that are consistent with those of the filled regions;
        for example, a contour line on the boundary between two
        regions will have a color intermediate between those
        of the regions.

        i    i   u   bothu   minu   maxN(   u   bothu   min(   u   bothu   max(   u   bothu   maxu   min(   R   t
   monochromeR9   R   R%   R&   R$  R   R'   t   rangeR(   t   set_normR=   R  t	   set_arrayt   autoscale_NoneR    R   t   clip(   R   RS  t   i1(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR9    s     	

c         C` s   |  j  } t |  j  } | d  k r> t j d f g | } n t j |  s] | g | } ni t |  } t |  | k  r t	 t
 j | t |    } | | } n  t |  | k r | |  } n  g  | D] } | f ^ q } | S(   Nu   lines.linewidth(   R!  R%   R&   R   R/  R0  R?   R@   R'   Rc   R   R   (   R   R!  t   NlevRE  t   nrepst   w(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRD  %  s    	c   	      C` sH  |  j  } t |  j  } | d  k r d g | } |  j rDt j d } |  j |  j d } x9 t	 |  j  D]% \ } } | | k  rl | | | <ql ql WqDn t
 | t j  r | g | } n t j |  r8t |  } t |  | k  rt t j | t |    } | | } n  t |  | k rD| |  } qDn t d   | S(   Nu   solidu   contour.negative_linestylegV瞯<u&   Unrecognized type for linestyles kwarg(   R"  R%   R&   R   R  R/  R0  R}  R  R)   Ro   Rp   Rq   R?   R@   R'   Rc   R   R   R+   (	   R   R"  R  R`  t   neg_lst   epsRS   RT   R  (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRF  7  s*    		c         C` s   |  j  S(   u5   returns alpha to be applied to all ContourSet artists(   R   (   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyRq  P  s    c         C` s   | |  _  |  j   d S(   u   
        Set the alpha blending value for all ContourSet artists.
        *alpha* must be between 0 (transparent) and 1 (opaque).
        N(   R   RN  (   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR  T  s    	c         C` sA  | d k r* t t t |  j    } n  t j } d } d } d } d }	 t j | | g  }
 x | D] } |  j | } | j	   } | j
   } x t |  D] \ } } | j } | r | j |  } n  t | |
  \ } } } | | k  r | } | } | } | d } | d } | d }	 q q Wqg W| | | | |	 | f S(   u  
        Finds contour that is closest to a point.  Defaults to
        measuring distance in pixels (screen space - useful for manual
        contour labeling), but this can be controlled via a keyword
        argument.

        Returns a tuple containing the contour, segment, index of
        segment, x & y of segment point and distance to minimum point.

        Optional keyword arguments:

          *indices*:
            Indexes of contour levels to consider when looking for
            nearest point.  Defaults to using all levels.

          *pixel*:
            If *True*, measure distance in pixel space, if not, measure
            distance in axes space.  Defaults to *True*.

        i   i    N(   R   R'   R   R%   R&   R   R  R   R   R   R   R)   R   R   R  (   R   R   R   RQ   t   pixelR  R   R   R   R   R  R   R  R   R   R  R  R   Ra   R  R  R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR   \  s2    		

N(   R   R   R   R6  R   Rj  t   strR{  R2  R:  R?  R@  RN  R  R  R3  R9  RD  RF  Rq  R  R   R#   R   (    (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR    s&   7			C	$						)	!	-				t   QuadContourSetc           B` sA   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d Z RS(   u  
    Create and store a set of contour lines or filled regions.

    User-callable method: `~axes.Axes.clabel`

    Attributes
    ----------
    ax:
        The axes object in which the contours are drawn.

    collections:
        A silent_list of LineCollections or PolyCollections.

    levels:
        Contour levels.

    layers:
        Same as levels for line contours; half-way between
        levels for filled contours. See :meth:`_process_colors` method.
    c         O` s!  t  | d t  r |  j d k r5 | d j |  _ n  | d j |  _ | d j |  _ | d j |  _ | d j } | d j |  _ | d j	 |  _	 n| j
 d d  |  _ |  j d k r t j d |  _ n  |  j | |  \ } } } t j |  } | t j k s| j   rd } n  t j | | | j   | |  j |  j  } |  j   } | |  j j k rt | j |  j j   r| |  j j }	 t j | j | j g  j }
 |	 j |
  } | d } | d } n  t j |  t j |  g |  _ t j  |  t j  |  g |  _	 | |  _ | S(	   u*   
        Process args and kwargs.
        i    u   corner_masku   contour.corner_mask.i   N(   .i    (   .i   (!   Ro   R  R&   R   R  R}  t   _corner_maskt   _contour_generatorRI  RJ  R   R/  R0  t   _contour_argsR   t   getmaskt   nomaskRZ   t   _contourt   QuadContourGeneratorR$  R)  R   R   R   t   contains_branch_seperatelyR   t   vstackt   flatR   R   R~  R|  (   R   RK   RL   t   contour_generatorR   R   R  t   _maskR   t   trans_to_datat   ptst   transformed_pts(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR2    s<    	$
!!	c   	      C` s   g  } |  j  r |  j   \ } } g  } x t | |  D]A \ } } |  j j | |  \ } } | j |  | j |  q7 Wn9 d } x0 |  j D]% } |  j j |  } | j |  q W| | f S(   u7   Compute ``allsegs`` and ``allkinds`` using C extension.N(	   R$  R?  R   R  t   create_filled_contourR*   R   R&   t   create_contour(	   R   R;  RY  RZ  R<  R[  R\  R   R^  (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR:    s    		c         C` sm  |  j  r d } n d } t |  } | d k rn t j | d d t j } |  j |  \ } } | d } nN | d k r |  j | d  |  \ } } } | d } n t d	 | | f   t j	 | d
 t
 } t | j    |  _ t | j    |  _ |  j rP|  j d k rPt j | d k |  } t j d  t | j    |  _ n  |  j | |  | | | f S(   Nu   contourfu   contouri   i    R   i   i   i   u&   Too many arguments to %s; see help(%s)Rh  u,   Log scale: values of z <= 0 have been masked(   R$  R%   R   R   R   R  t   _initialize_x_yt
   _check_xyzR-   t   masked_invalidR    R   R|  R}  R~  R  R.  t   masked_whereR=  R>  R  (   R   RK   RL   R  t   NargsR  R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR    s,    		c   
      C` s-  | d  \ } } |  j  j d | d | d |  } |  j  j |  } |  j  j |  } t j | d t j } t j | d t j } t j | d d t j } | j d k r t	 d   nD | j
 d d k  s | j
 d d k  r t	 d	   n | j
 \ } } | j | j k r$t	 d
   n  | j d k r| j
 \ } | j
 \ }	 | | k rft	 d   n  |	 | k rt	 d   n  t j | |  \ } } n | j d k r| j
 | j
 k rt	 d j | j
 | j
    n  | j
 | j
 k r t	 d j | j
 | j
    q n t	 d   | | | f S(   u   
        For functions like contour, check that the dimensions
        of the input arrays match; if x and y are 1D, convert
        them to 2D using meshgrid.

        Possible change: I think we should make and use an ArgumentError
        Exception class (here and elsewhere).
        i   t   xdatat   ydataRL   R   u   Input z must be a 2D array.i    i   u%   Input z must be at least a 2x2 array.u-   Number of dimensions of x and y should match.u+   Length of x must be number of columns in z.u(   Length of y must be number of rows in z.u>   Shape of x does not match that of z: found {0} instead of {1}.u>   Shape of y does not match that of z: found {0} instead of {1}.u    Inputs x and y must be 1D or 2D.(   R   t   _process_unit_infot   convert_xunitst   convert_yunitsR   R   R  R   t   ndimR-   R   t   meshgridR,   (
   R   RK   RL   R   R   R  t   Nyt   Nxt   nxt   ny(    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR    s>    	!&		c         C` s  | j  d k r t d   nD | j d d k  sD | j d d k  rS t d   n | j \ } } |  j d k r |  j d k r t j t j |  t j |   S|  j \ } } } } t j	 | | |  } t j	 | | |  }	 t j | |	  Sn  |  j d k r$d | d | f \ } } } } n |  j \ } } } } | | | }
 | | | } | t j |  d |
 } | t j |  d | }	 |  j d k r|	 d d d	  }	 n  t j | |	  S(
   u  
        Return X, Y arrays such that contour(Z) will match imshow(Z)
        if origin is not None.
        The center of pixel Z[i,j] depends on origin:
        if origin is None, x = j, y = i;
        if origin is 'lower', x = j + 0.5, y = i + 0.5;
        if origin is 'upper', x = j + 0.5, y = Nrows - i - 0.5
        If extent is not None, x and y will be scaled to match,
        as in imshow.
        If origin is None and extent is not None, then extent
        will give the minimum and maximum values of x and y.
        i   u   Input must be a 2D array.i    i   u%   Input z must be at least a 2x2 array.g      ?u   upperNi(
   R  R-   R   R&  R   R'  R   R  R   t   linspace(   R   R  R  R  t   x0t   x1t   y0t   y1R   R   R   R   (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR  D  s,    &"!u!  
        Plot contours.

        Call signature::

            contour([X, Y,] Z, [levels], **kwargs)

        :func:`~matplotlib.pyplot.contour` and
        :func:`~matplotlib.pyplot.contourf` draw contour lines and
        filled contours, respectively.  Except as noted, function
        signatures and return values are the same for both versions.


        Parameters
        ----------
        X, Y : array-like, optional
            The coordinates of the values in *Z*.

            *X* and *Y* must both be 2-D with the same shape as *Z* (e.g.
            created via :func:`numpy.meshgrid`), or they must both be 1-D such
            that ``len(X) == M`` is the number of columns in *Z* and
            ``len(Y) == N`` is the number of rows in *Z*.

            If not given, they are assumed to be integer indices, i.e.
            ``X = range(M)``, ``Y = range(N)``.

        Z : array-like(N, M)
            The height values over which the contour is drawn.

        levels : int or array-like, optional
            Determines the number and positions of the contour lines / regions.

            If an int *n*, use *n* data intervals; i.e. draw *n+1* contour
            lines. The level heights are automatically chosen.

            If array-like, draw contour lines at the specified levels.
            The values must be in increasing order.

        Returns
        -------
        :class:`~matplotlib.contour.QuadContourSet`

        Other Parameters
        ----------------
        corner_mask : bool, optional
            Enable/disable corner masking, which only has an effect if *Z* is
            a masked array.  If ``False``, any quad touching a masked point is
            masked out.  If ``True``, only the triangular corners of quads
            nearest those points are always masked out, other triangular
            corners comprising three unmasked points are contoured as usual.

            Defaults to ``rcParams['contour.corner_mask']``, which defaults to
            ``True``.

        colors : color string or sequence of colors, optional
            The colors of the levels, i.e. the lines for `.contour` and the
            areas for `.contourf`.

            The sequence is cycled for the levels in ascending order. If the
            sequence is shorter than the number of levels, it's repeated.

            As a shortcut, single color strings may be used in place of
            one-element lists, i.e. ``'red'`` instead of ``['red']`` to color
            all levels with the same color. This shortcut does only work for
            color strings, not for other ways of specifying colors.

            By default (value *None*), the colormap specified by *cmap*
            will be used.

        alpha : float, optional
            The alpha blending value, between 0 (transparent) and 1 (opaque).

        cmap : str or `.Colormap`, optional
            A `.Colormap` instance or registered colormap name. The colormap
            maps the level values to colors.
            Defaults to :rc:`image.cmap`.

            If given, *colors* take precedence over *cmap*.

        norm : `~matplotlib.colors.Normalize`, optional
            If a colormap is used, the `.Normalize` instance scales the level
            values to the canonical colormap range [0, 1] for mapping to
            colors. If not given, the default linear scaling is used.

        vmin, vmax : float, optional
            If not *None*, either or both of these values will be supplied to
            the `.Normalize` instance, overriding the default color scaling
            based on *levels*.

        origin : {*None*, 'upper', 'lower', 'image'}, optional
            Determines the orientation and exact position of *Z* by specifying
            the position of ``Z[0, 0]``.  This is only relevant, if *X*, *Y*
            are not given.

            - *None*: ``Z[0, 0]`` is at X=0, Y=0 in the lower left corner.
            - 'lower': ``Z[0, 0]`` is at X=0.5, Y=0.5 in the lower left corner.
            - 'upper': ``Z[0, 0]`` is at X=N+0.5, Y=0.5 in the upper left
              corner.
            - 'image': Use the value from :rc:`image.origin`. Note: The value
              *None* in the rcParam is currently handled as 'lower'.

        extent : (x0, x1, y0, y1), optional
            If *origin* is not *None*, then *extent* is interpreted as
            in :func:`matplotlib.pyplot.imshow`: it gives the outer
            pixel boundaries. In this case, the position of Z[0,0]
            is the center of the pixel, not a corner. If *origin* is
            *None*, then (*x0*, *y0*) is the position of Z[0,0], and
            (*x1*, *y1*) is the position of Z[-1,-1].

            This keyword is not active if *X* and *Y* are specified in
            the call to contour.

        locator : ticker.Locator subclass, optional
            The locator is used to determine the contour levels if they
            are not given explicitly via *levels*.
            Defaults to `~.ticker.MaxNLocator`.

        extend : {'neither', 'both', 'min', 'max'}, optional
            Unless this is 'neither', contour levels are automatically
            added to one or both ends of the range so that all data
            are included. These added ranges are then mapped to the
            special colormap values which default to the ends of the
            colormap range, but can be set via
            :meth:`matplotlib.colors.Colormap.set_under` and
            :meth:`matplotlib.colors.Colormap.set_over` methods.

        xunits, yunits : registered units, optional
            Override axis units by specifying an instance of a
            :class:`matplotlib.units.ConversionInterface`.

        antialiased : bool, optinal
            Enable antialiasing, overriding the defaults.  For
            filled contours, the default is *True*.  For line contours,
            it is taken from :rc:`lines.antialiased`.

        Nchunk : int >= 0, optional
            If 0, no subdivision of the domain.  Specify a positive integer to
            divide the domain into subdomains of *nchunk* by *nchunk* quads.
            Chunking reduces the maximum length of polygons generated by the
            contouring algorithm which reduces the rendering workload passed
            on to the backend and also requires slightly less RAM.  It can
            however introduce rendering artifacts at chunk boundaries depending
            on the backend, the *antialiased* flag and value of *alpha*.

        linewidths : float or sequence of float, optional
            *Only applies to* `.contour`.

            The line width of the contour lines.

            If a number, all levels will be plotted with this linewidth.

            If a sequence, the levels in ascending order will be plotted with
            the linewidths in the order specified.

            Defaults to :rc:`lines.linewidth`.

        linestyles : {*None*, 'solid', 'dashed', 'dashdot', 'dotted'}, optional
            *Only applies to* `.contour`.

            If *linestyles* is *None*, the default is 'solid' unless the lines
            are monochrome.  In that case, negative contours will take their
            linestyle from :rc:`contour.negative_linestyle` setting.

            *linestyles* can also be an iterable of the above strings
            specifying a set of linestyles to be used. If this
            iterable is shorter than the number of contour levels
            it will be repeated as necessary.

        hatches : List[str], optional
            *Only applies to* `.contourf`.

            A list of cross hatch patterns to use on the filled areas.
            If None, no hatching will be added to the contour.
            Hatching is supported in the PostScript, PDF, SVG and Agg
            backends only.


        Notes
        -----
        1. :func:`~matplotlib.pyplot.contourf` differs from the MATLAB
           version in that it does not draw the polygon edges.
           To draw edges, add line contours with
           calls to :func:`~matplotlib.pyplot.contour`.

        2. contourf fills intervals that are closed at the top; that
           is, for boundaries *z1* and *z2*, the filled region is::

              z1 < Z <= z2

           There is one exception: if the lowest boundary coincides with
           the minimum value of the *Z* array, then that minimum value
           will be included in the lowest interval.
        (	   R   R   R   R2  R:  R  R  R  t   _contour_doc(    (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyR    s   	.			7	(9   R   t
   __future__R    R   R   R   Rp   t	   six.movesR   R=  t
   matplotlibR/  t   numpyR   R   t   matplotlib._contourR  t   matplotlib.patht   pathR   t   matplotlib.tickerR,  t   matplotlib.cmR;   t   matplotlib.colorsR9   t   matplotlib.collectionsR   RA  t   matplotlib.font_managerR0   t   matplotlib.textR   t   matplotlib.cbookR?   t   matplotlib.mathtextRy   t   matplotlib.patchest   patchesRm  t   matplotlib.texmanagerRu   t   matplotlib.transformst
   transformsRd  t   matplotlib.blocking_inputR   R	   R   t   objectR   R  R   R  R<   R  R  (    (    (    s1   lib/python2.7/site-packages/matplotlib/contour.pyt   <module>   s@   "
  j				!  