ó
±éRc           @  s¦  d  Z  d d l m Z 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' j( Z) d d l* m+ Z+ d e j, f d „  ƒ  YZ- d f  d	 „  ƒ  YZ. d
 „  Z/ d „  Z0 d e j1 e. f d „  ƒ  YZ2 d e2 f d „  ƒ  YZ3 d S(   sQ   
These are  classes to support contour plotting and
labelling for the axes class
iÿÿÿÿ(   t   divisiont   print_functionN(   t   ma(   t   BlockingContourLabelert
   ClabelTextc           B  s   e  Z d  Z d „  Z RS(   sÊ   
    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(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR   *   s    (   t   __name__t
   __module__t   __doc__R   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/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 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(   s3   Mixin to provide labelling capability to ContourSetc         O  sæ  | 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 |  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ªd t |	 ƒ } | d 7} | t |  j	 ƒ 7} t | ƒ ‚ qªn t d ƒ ‚ | |  _ | |  _ t j ƒ  |  _ | d k rït |  j j ƒ  ƒ } nj t | ƒ t t t g k rt d ƒ ‚ n@ t | ƒ t k rCt |  j j ƒ  ƒ } n |  j j | ƒ | } | g t | ƒ |  _ | d k r¢|  |  _ t j |  j |  j ƒ |  _  nW t! j" | d t |  j ƒ ƒ} t
 t |  j ƒ ƒ |  _  t# j$ d | d t! j% ƒ  ƒ |  _ g  |  _& t' j( |  j ƒ rGxŒ |  j D]" \ } } |  j) | | | | ƒ qWn\ |  j r“t* d ƒ t* d ƒ | swt* d ƒ n  t+ |  ƒ } | | | ƒ n |  j, | | ƒ |  j- |  _. |  j& |  _/ |  j0 |  _1 t' j2 d |  j- ƒ |  _3 |  j3 S(   só  
        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*.

        Optional keyword arguments:

          *fontsize*:
            size in points or relative size eg 'smaller', 'x-large'

          *colors*:
            - 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*:
            controls whether the underlying contour is removed or
            not. Default is *True*.

          *inline_spacing*:
            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*:
            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*:
            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 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*:
            if *True* (default), label rotations will always be plus
            or minus 90 degrees from level.

          *use_clabeltext*:
            if *True* (default is False), ClabelText class (instead of
            matplotlib.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.

        .. plot:: mpl_examples/pylab_examples/contour_demo.py
        t   fontsizet   inlinei   t   inline_spacingi   t   fmts   %1.3ft   colorst   use_clabeltextt   manualt   rightside_upi    s   Specified levels s   
 don't match available levels s-   Illegal arguments to clabel, see help(clabel)s$   Font size must be an integer number.t   Nt   cmapt   norms9   Select label locations manually using first mouse button.s.   End manual selection with second mouse button.s1   Remove last label by clicking third mouse button.s	   text.TextN(4   t   gett   Nonet   labelFmtt   Falset   _use_clabeltextt   labelManualt   TrueR   t   lent   levelst   ranget   cvaluest   listt	   enumeratet   appendt   strt
   ValueErrort	   TypeErrort   labelLevelListt   labelIndiceListt   font_managert   FontPropertiest   labelFontPropst   intt   get_size_in_pointst   typet   floatt   set_sizet   labelFontSizeListt   labelMappableR   t   taket   labelCValueListR   t   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   kwargsR   R   R   t   _colorsR*   t   indicest   levlabst   it   levt   msgt	   font_sizeR    R   R   t   blocking_contour_labeler(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   clabel6   sz    \	
					

c   	      C  sÖ   t  | ƒ } | d | k r  t St j | d d … d f ƒ } t j | d d … d f ƒ } t j | d d … d f ƒ } t j | d d … d f ƒ } | } | | d | k sÊ | | d | k rÎ t St Sd S(   s5   Return *False* if contours are too short for a label.i
   Ni    i   g333333ó?(   R)   R(   R   t   amaxt   aminR%   (	   R   t   linecontourt
   labelwidtht   lcsizet   xmaxt   xmint   ymaxt   ymint   lw(    (    sL   /opt/xtal/ccp4-6.5-linux32/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(   s7   Return *True* if a label is already near this location.i    i   i   g333333ó?(   RE   R   t   sqrtR(   R%   (   R   R   R   Rf   t   loct   d(    (    sL   /opt/xtal/ccp4-6.5-linux32/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(   s…  
        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    (   R8   R   t   argsortRk   (   R   t	   distancest   XXt   YYt   ysizeRf   t   hysizet   adistt   indR   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   get_label_coords  s    
c         C  s  t  j | ƒ s$ |  j | | ƒ } n  t j j | ƒ \ } } | d k rŠ t |  d ƒ si 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(	   s:   
        Return the width of the label in points.
        t   TeXt   _TeX_managert   _mathtext_parsert   bitmapt   dpiiH   t   propg333333ã?(   RF   t   is_string_liket   get_textR   R   t   is_math_textt   hasattrt
   texmanagert
   TexManagerRv   t   get_text_width_height_descentt   mathtextt   MathTextParserRw   t   parseR7   t	   get_widthR)   (   R   RX   R   t   fsizet   ismathRf   t   _t   img(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   get_label_width  s     c         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(   s  
        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   t   axisi   i    t   kt   rendererN(   R   t   meant   asarrayt   axR‹   t   reshapeR   R   t   set_label_propsR|   t   get_window_extentt   figuret   canvasR�   t   difft   corners(   R   RX   R   R†   t   xxt   tt   bboxRf   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   get_real_label_width2  s    	3,c         C  sA   | j  | ƒ | j | ƒ | j |  j ƒ | j |  j j ƒ d S(   s0   set the label properties - color, fontsize, textN(   t   set_textt	   set_colort   set_fontpropertiesR7   t   set_clip_boxR�   Rš   (   R   t   labelR   t   color(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR’   L  s    c         C  sL   t  j | ƒ r | St | t ƒ r* | | St | ƒ r@ | | ƒ S| | Sd S(   s   get the text of the labelN(   RF   R{   t
   isinstancet   dictt   callable(   R   RX   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR|   S  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 f j | d ƒ } | d d … d f j | d ƒ }	 | d d … d f j | d ƒ }
 | d d … d f j | d ƒ } | | | |
 |
 | |	 | } t j | |
 d |	 | d ƒ j ƒ  } t j j	 g  t
 | ƒ D] } t | ƒ | | | ^ q”d ƒ } |  j | | | | | ƒ \ } } } g  | D] } t | ƒ ^ qé} | j | | f ƒ } | | | f S(   sb   
        Find a good place to plot a label (relatively flat
        part of the contour).
        i   Ni    iÿÿÿÿi   (   R)   R8   R   t   ceilt   resizeR‘   Rh   t   ravelt   addt   reduceR+   t   absRt   t   tuplet   index(   R   R_   R`   t   nsizet   xsizeRp   Rn   Ro   t   yfirstt   ylastt   xfirstt   xlastt   st   LRW   t   distR   R   Rs   t   lt   lct   dind(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   locate_label_  s(    	((""""")@$i   c         C  sŸ  | d k r g  } n  | d } t j | ƒ } | r� t j | | d !| | d  f } t | ƒ r‡ t j | | d !| | d  f } n  d } n  t j | ƒ } | | | } t j | | g ƒ }	 | rå t j | d d g ƒ }
 n t j |	 ƒ }
 t j	 | | |
 |	 d t
 ƒ} t j | d d ƒj ƒ  } t j | d k ƒ rLd } n% t j | d | d ƒ d t j } |  j r¯| d	 k r“| d } n  | d
 k  r¯d | } q¯n  g  } t | ƒ r•|
 |	 t j | | g ƒ }	 t j	 | t j t | ƒ ƒ |	 d t ƒ} t j | d ƒ rVt | d ƒ | d k rVt j	 | | |	 d g ƒ } n  t j | d ƒ r£t | d ƒ | d k r£t j	 | | |	 d g ƒ } n  t j | d ƒ t j | d ƒ g } | rt j t j | ƒ ƒ r’| j t j | | | d | d d !| f ƒ q’q•t j | d ƒ sZ| j t j | | d d  | f ƒ n  t j | d ƒ s•| j t j | | | d f ƒ q•n  | | f S(   s  
        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 calling mlab.path_length
        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       @iÿÿÿÿi   i    t   extrapR‹   g        g     €f@iZ   i¦ÿÿÿN(   R#   t   mlabt   is_closed_polygonR   t   r_R)   t   path_lengthR   t
   zeros_liket    less_simple_linear_interpolationR(   R–   R§   t   allt   arctan2t   piR   t   arangeR%   t   isnanR8   t   floorR¥   R/   (   R   t   slcRs   Rf   R·   t   spacingt   hlwt   closedt   plt   xit   dpt   llt   ddt   rotationt   nlct   It   xy1t   xy2(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   calc_label_rot_and_inline„  s\    	
"%			%	$..&6)(c      	   C  sO   |  j  j j ƒ  j | | f ƒ \ } } t j | | d | d d d d ƒ} | S(   NRÐ   t   horizontalalignmentt   centert   verticalalignment(   R�   t	   transDatat   invertedt   transform_pointR   R   (   R   R   R   RÐ   t   dxt   dyR™   (    (    sL   /opt/xtal/ccp4-6.5-linux32/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Ö   R×   RØ   (   R�   RÙ   RÚ   RÛ   R
   R   R   R   (	   R   R   R   RÐ   t   transDataInvRÜ   RÝ   t	   drotationR™   (    (    sL   /opt/xtal/ccp4-6.5-linux32/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(   R>   t   to_rgbaRâ   R|   R$   R’   RK   R/   RN   RE   R�   t
   add_artist(   R   R™   R   R   RX   t   cvalueR¡   t   _text(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt
   _add_label  s    c         C  s2   |  j  | | | ƒ } |  j | | | | | ƒ d S(   sO   
        Add contour label using :class:`~matplotlib.text.Text` class.
        N(   RÞ   Rç   (   R   R   R   RÐ   RX   Rå   R™   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt	   add_label  s    c         C  s2   |  j  | | | ƒ } |  j | | | | | ƒ d S(   sD   
        Add contour label using :class:`ClabelText` class.
        N(   Rá   Rç   (   R   R   R   RÐ   RX   Rå   R™   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   add_label_clabeltext  s    	c         C  sF  | d k r |  j j } n  | r? | j | | f ƒ \ } } n  |  j | | |  j ƒ d  \ } } } }	 }
 |  j | j ƒ  } | | j } | r® | j	 ƒ  j
 |	 |
 g ƒ } n t 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 | ƒ } | r¢| } n d } |  j | | | | | ƒ \ } } |  j |	 |
 | |  j | |  j | ƒ | rB| j | ƒ x< | D]1 } t | ƒ d k r
| j t j | ƒ ƒ q
q
Wn  d S(   sA  
        Add a label near the point (x, y) of the given transform.
        If transform is None, data transform is used. If transform is
        False, IdentityTransform is used.

        *inline*:
          controls whether the underlying contour is removed or
          not. Default is *True*.

        *inline_spacing*:
          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.
        i   Ni   (   R#   R�   RÙ   RÛ   t   find_nearest_contourR4   t   collectionst	   get_pathst   verticesRÚ   t	   transformR   R   t   allcloseR½   t   mpatht   PathR¬   RŠ   R3   R$   R=   RÕ   Rè   R@   t   popR)   R/   (   R   R   R   R   R   Rî   t   conmint   segmint   iminRc   Re   t   pathsR·   t   xcmint   lminRÇ   Rf   t   lcargRÐ   RÑ   t   n(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRH   $  sB    %7	iÿÿÿÿc         C  s0   |  j  j | ƒ |  j j | ƒ } | j ƒ  d S(   s>   Defaults to removing last label, but any index can be suppliedN(   RN   Rò   RK   t   remove(   R   R¬   R™   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt	   pop_labeln  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 ƒ  } xAt | ƒ D]3\ } } | j } |	 j | ƒ } t j | ƒ rt j | | d d … d  d  … f f } n | } |  j | |
 ƒ rß|  j | |
 ƒ \ } } } | rZ| } 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   zipR4   R3   R=   R@   Rë   R   RŠ   R$   R�   R”   Ry   Rì   R.   Rí   Rî   R»   R¼   R   R½   Rg   R¹   R#   RÕ   R)   R/   Rð   Rñ   t   extend(   R   R   R   Rè   t   iconRX   R†   Rå   t   conR   Rf   t	   additionsRö   t   segNumt   linepathR·   t   slc0RÇ   R   R   Rs   Rù   RÐ   t   newRú   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRJ   t  sF    		"	,	#N(   R   R   R   R\   Rg   Rk   Rt   RŠ   R›   R’   R|   R¹   R#   RÕ   RÞ   Rá   Rç   Rè   Ré   R(   RH   Rü   RJ   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR   3   s(   	²								%j					I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(   s=   find closest point to p0 on line segment connecting p1 and p2i   i    i   (   R   RÁ   t   sumt   dot(   t   p1t   p2t   p0Rj   t   d21t   d01t   projt   pc(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   _find_closest_point_on_leg±  s    


"		c         C  s@  t  j |  | d d d … f d d ƒ } t  j | ƒ } t  j } d } d } t j |  ƒ } g  } | d k su | 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(   sJ   
    lc: coordinates of vertices
    point: coordinates of test point
    Ni   i   i    (   NN(
   R   R  R#   t   argmint   infR»   R¼   R/   R)   R  (   R·   t   pointt   dsRõ   t   dminR÷   t   legminRÊ   t   legst   legRj   t   xc(    (    sL   /opt/xtal/ccp4-6.5-linux32/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(   s·  
    Store a set of contour lines or filled regions.

    User-callable method: clabel

    Useful 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 d, ƒ |  _ | j d t ƒ |  _ | j d d, ƒ |  _ | j d d, ƒ |  _ | j d d, g ƒ |  _ | j d d, ƒ |  _	 | j d d, ƒ |  _
 | j d d, ƒ |  _ | j d	 d, ƒ } | j d
 d, ƒ |  _ | j d d, ƒ } | j d d, ƒ } | j d d, ƒ } | j d d ƒ |  _ | j d d, ƒ |  _ |  j d, k r_|  j r_t |  _ n  | j d d ƒ |  _ | j d d, ƒ |  _ t | t j ƒ s°t |  j t j ƒ rõt |  _ | d, k rÔt j ƒ  } n  |  j d k	 rþt d ƒ ‚ qþn	 t |  _ |  j
 d, k	 r%|  j
 d- k s%t ‚ n  |  j d, k	 rRt |  j ƒ d k sRt ‚ n  |  j d, k	 r|| d, k	 r|t d ƒ ‚ n  |  j
 d k ržt j d |  _
 n  | j d d, ƒ |  _ |  j | | Ž  |  j ƒ  |  j d, k	 rét |  j ƒ } |  j r| d 8} n  d }	 |  j d. k }
 |  j d/ k } t } | t |
 ƒ t | ƒ } t |  j ƒ | k r„t  |
 | g ƒ r„t } |
 r„d }	 q„n  t j! |  j |	 d, !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} | d, k	 rQ| | d <n  t) j* j+ |  | � | d, k	 r| |  j, _- n  | d, k	 rš| |  j, _. n  |  j/ ƒ  |  j0 ƒ  \ |  _1 |  _2 |  j rÖ|  j d, k	 rät3 j4 d$ ƒ n  |  j5 ƒ  \ } } |  j2 d, k r!d, g t |  j1 ƒ |  _2 n  xªt6 | | |  j1 |  j2 ƒ D]’ \ } } } } |  j7 | | ƒ } | j d% d ƒ } t8 j9 | d& |  j f d' d( d |  j	 d |  j: ƒ  d% | ƒ} |  j  j; | ƒ |  j& j< | ƒ q=Wnø |  j= ƒ  } | |  _> |  j? ƒ  } |  j } | d, k	 r|  j f } n  x° t6 |  j | | |  j1 ƒ D]“ \ } } } } | j d% d) ƒ } t8 j@ | d& | d | d* | g d |  j	 d |  j: ƒ  d% | ƒ} | jA d+ ƒ |  j  j; | t ƒ |  j& j< | ƒ q7W|  jB ƒ  d, S(0   s  
        Draw contour lines or filled regions, depending on
        whether keyword arg 'filled' is *False* (default) or *True*.

        The first three arguments must be:

          *ax*: axes object.

          *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``.

            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).

            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].

        Keyword arguments are as described in
        :class:`~matplotlib.contour.QuadContourSet` object.

        **Examples:**

        .. plot:: mpl_examples/misc/contour_manual.py
        R*   t   filledt
   linewidthst
   linestylest   hatchesRâ   t   origint   extentR    R   R!   t   vmint   vmaxRþ   t   neithert   antialiasedt   nchunki    t   locators.   extend kwarg does not work yet with log  scalet   lowert   uppert   imagei   s"   Either colors or cmap must be Nones   image.originRî   i   t   mint   botht   maxR   iÿÿÿÿs   mcoll.PathCollections   mcoll.LineCollections!   linewidths is ignored by contourft   zordert   antialiasedst
   edgecolorst   nonei   t	   linestylet
   _nolegend_N(   s   lowers   uppers   image(   s   minR+  (   s   maxR+  (C   R�   R"   R#   R*   R%   R  R  R  R  Râ   R  R   R   Rþ   R$  R%  R&  R¢   t   LogNormt   tickert
   LogLocatorR(   t   logscaleR1   t   AssertionErrorR)   t   mplt   rcParamst
   _transformt   _process_argst   _process_levelsR8   t   anyRA   t	   set_undert   set_overRF   RP   Rë   RK   RN   RB   RC   t   __init__R!   R!  R"  t   _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   changed(   R   R�   RR   RS   R    R!   R!  R"  t   ncolorst   i0t
   extend_mint
   extend_maxt   use_set_under_overt   total_levelst   kwt   lowerst   upperst   levelt   level_uppert   segst   kindsRö   R-  t   colRM  t   tlinestylest   aat   widtht   lstyle(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR@  ÿ  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(   sp   
        Return the :class:`~matplotlib.transforms.Transform`
        instance used by this ContourSet.
        t   _as_mpl_transformN(	   R:  R#   R�   RÙ   R¢   t   mtranst	   TransformR~   Rd  (   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR   Ã  s    c         C  s   |  j  j ƒ  } d  | d <| S(   Nt   Cntr(   t   __dict__t   copyR#   (   R   t   state(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   __getstate__Ï  s    
R   c         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(   sQ  
        Return a list of artist and labels suitable for passing through
        to :func:`plt.legend` which represent this ContourSet.

        Args:

            *variable_name*: the string used inside the inequality used
              on the labels

            *str_format*: function used to format the numbers in the labels
        i    i   t	   facecolort   hatchRâ   R*  R+  s   $%s \leq %s$R,  s	   $%s > %s$s   $%s < %s \leq %s$s	   $%s = %s$(   i    i    (   s   mins   both(   s   maxs   bothN(   R  RG  R)   Rë   R.   Rý   t   mpatchest	   Rectanglet   get_facecolort	   get_hatcht	   get_alphaR/   Rþ   R*   RI  RO  R#   t   update_from(   R   t   variable_namet
   str_formatt   artistsRJ   RY  RZ  t   n_levelsRW   t
   collectionR'  R(  t   patchR[  (    (    sL   /opt/xtal/ccp4-6.5-linux32/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  t
 } x  |  j D]• } xŒ | D]„ } t j | ƒ } | r�t j | | j d d ƒ ƒ } t j | | j d d ƒ ƒ } q5| j d d ƒ } | j d d ƒ } t } q5Wq(W| ró|  j j | | g ƒ |  j j d t ƒ n  d	 S(
   s£   
        Process *args* and *kwargs*; override in derived classes.

        Must set self.levels, self.zmin and self.zmax, and update axes
        limits.
        i    i   i   s-   must be one less number of segments as levelss)   must be same number of segments as levelss(   allkinds has different length to allsegsR‹   t   tightN(   R*   RC  R)   R#   RD  R   R]   t   zmaxR^   t   zminR%   t   _autoR  R1   R�   t   minimumR*  t   maximumR,  R(   R�   t   update_datalimt   autoscale_view(   R   RR   RS   t
   havelimitsR]  t   segR*  R,  (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR;    s6    %		"!c         C  s   |  j  |  j f S(   sv   
        Override in derived classes to create and return allsegs and allkinds.
        allkinds can be None.
        (   RC  RD  (   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRB  9  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(   s=   
        Return (lowers,uppers) for filled contours.
        iÿÿÿÿi    g®Gáz®ï?i   (   t   _levelsR}  Ri  R6  (   R   RY  RZ  (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRG  @  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(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRH  O  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�   RK   RN   t	   set_alphaR>   RB   RC   RQ  (	   R   t   rgbaRˆ  R  R¡   Rm  Rx  R    t   cv(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRQ  V  s    4		"c         C  s˜   |  j  d k rC |  j r* t j ƒ  |  _  qC t j | d ƒ |  _  n  |  j } |  j } |  j  j | | ƒ } t	 |  _
 |  j r€ | S| | | k | | k  @S(   sµ  
        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   N(   R&  R#   R6  R4  R5  t   MaxNLocatorR|  R}  t   tick_valuesR(   R~  R  (   R   t   zR   R|  R}  RX   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   _autolevi  s    					c         C  s  |  j  r d } n d } t |  _ |  j d k rÓ t | ƒ d k rW |  j | d ƒ } np | d } yF t | ƒ t k r‹ |  j | | ƒ } n t	 j
 | ƒ j t	 j ƒ } Wn t d | | f ƒ ‚ n X| |  _ n  |  j  r t |  j ƒ d k  r t d ƒ ‚ n  d S(	   sH   
        Determine the contour levels and store in self.levels.
        t   contourft   contouri    i   s*   Last %s arg must give levels; see help(%s)i   s*   Filled contours require at least 2 levels.N(   R  R%   R~  R*   R#   R)   R‘  R:   R8   R   R�   t   astypet   float64R2   R1   (   R   R�  RR   t   fnRX   t	   level_arg(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   _contour_level_args‚  s&    			
c         C  sG  t  j |  j ƒ |  _ t  j |  j ƒ |  _ t |  j ƒ |  _ |  j d	 k rx |  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!t  j |  j d <n  |  j d k rCt  j |  j d <n  d S(   s&  
        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.
        R+  R*  i    i   R,  iÿÿÿÿNg      à?(   s   boths   min(   s   boths   max(   s   boths   min(   s   boths   max(   R   R^   R*   R!  R]   R"  R-   R…  Rþ   t   insertR*  R}  R/   R,  R|  R�   R  t   layersR  (   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR<  �  s     -*	c         C  sô   |  j  j |  _ |  j d k	 r¬ d t |  j ƒ } } |  j rJ | d 8} n  |  j d k rb d } n  |  j d	 k r~ | d 7} n  t t	 | | ƒ ƒ |  _
 |  j t j ƒ  ƒ n |  j |  _
 |  j |  j ƒ |  j ƒ  |  j d
 k rð t |  j _ n  d S(   s  
        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   R+  R*  iÿÿÿÿR,  N(   s   boths   min(   s   boths   max(   s   boths   maxs   min(   R    t
   monochromeR   R#   R)   R*   R  Rþ   R-   R+   R,   t   set_normRD   Rš  t	   set_arrayt   autoscale_NoneR%   R!   t   clip(   R   RS  t   i1(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRA  Ã  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(   Ns   lines.linewidth(   R  R)   R*   R#   R8  R9  RF   RG   R-   R8   R   R¥   (   R   R  t   NlevRM  t   nrepst   w(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRL  ð  s    	c   	      C  sE  |  j  } t |  j ƒ } | d  k r› d g | } |  j rAt j d } |  j |  j d } x9 t	 |  j ƒ D]% \ } } | | k  rl | | | <ql ql WqAn¦ t
 j | ƒ rº | g | } n‡ t
 j | ƒ r5t | ƒ } t | ƒ | k  rt t j | t | ƒ ƒ ƒ } | | } n  t | ƒ | k rA| |  } qAn t d ƒ ‚ | S(   Nt   solids   contour.negative_linestylegVçž¯Ò<s&   Unrecognized type for linestyles kwarg(   R  R)   R*   R#   R›  R8  R9  R|  R}  R.   RF   R{   RG   R-   R8   R   R¥   R1   (	   R   R  R¡  R`  t   neg_lst   epsRW   RX   R¢  (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRN    s*    		c         C  s   |  j  S(   s5   returns alpha to be applied to all ContourSet artists(   Râ   (   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRr    s    c         C  s   | |  _  |  j ƒ  d S(   s%   sets alpha for all ContourSet artistsN(   Râ   RQ  (   R   Râ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR‹    s    	c         C  s;  | d k r$ 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™ Wqa W| | | | |	 | f S(   sX  
        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.

        Call signature::

          conmin,segmin,imin,xmin,ymin,dmin = find_nearest_contour(
                     self, x, y, indices=None, pixel=True )

        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   RU   t   pixelR  Ró   Rô   Rc   Re   R  Rÿ   R   R   Rö   R  R  R·   Rj   R  R  Rõ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRê   $  s2    #		

N(   R   R   R   R@  R   Rk  R0   Rz  R;  RB  RG  RH  RQ  R‘  R˜  R<  RA  RL  RN  Rr  R‹  R#   R(   Rê   (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR  ë  s&   	Ä		6	-							&	-				t   QuadContourSetc           B  sJ   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d Z	 RS(   sÑ  
    Create and store a set of contour lines or filled regions.

    User-callable method: :meth:`clabel`

    Useful 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  j |  | | | Ž d S(   sF  
        Calculate and draw contour lines or filled regions, depending
        on whether keyword arg 'filled' is False (default) or True.

        The first argument of the initializer must be an axes
        object.  The remaining arguments and keyword arguments
        are described in QuadContourSet.contour_doc.
        N(   R  R@  (   R   R�   RR   RS   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR@  }  s    	c         O  sÐ  t  | d t ƒ re | d j } |  j d k rB | d j |  _ n  | d j |  _ | d j |  _ n^|  j | | ƒ \ } } } t j	 | ƒ } | t j
 k r§ d } n  t j | | | j ƒ  | ƒ } |  j ƒ  } | |  j j k rRt | j |  j j ƒ ƒ rR| |  j j }	 t j | j | j g ƒ j }
 |	 j |
 ƒ } | d } | d } n  t j | ƒ } t j | ƒ } t j | ƒ } t j | ƒ } |  j j | | f | | f g ƒ |  j j d t ƒ | |  _ d S(   s*   
        Process args and kwargs.
        i    .i   R{  N(   .i    (   .i   (   R¢   R¨  Rg  R*   R#   R}  R|  t   _contour_argsR   t   getmaskt   nomaskt   _cntrR  R   R�   RÙ   R=  t   contains_branch_seperatelyR   t   vstackt   flatt   TRî   R  R€  R�  R‚  R(   (   R   RR   RS   t   CR   R   R�  t   _maskR™   t   trans_to_datat   ptst   transformed_ptst   x0t   x1t   y0t   y1(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR;  ˆ  s4    	
"c         C  s  g  } |  j  r¦ |  j ƒ  \ } } g  } xÏ t | | ƒ D]h \ } } |  j j | | d |  j ƒ} t | ƒ d } | |  }	 | | }
 | j |	 ƒ | j |
 ƒ q7 WnS d } xJ |  j	 D]? } |  j j | ƒ } t | ƒ d } | |  }	 | j |	 ƒ q¶ W| | f S(   sV   
        Create and return allsegs and allkinds by calling underlying C code.
        R%  i   N(
   R  RG  Rý   Rg  t   traceR%  R)   R/   R#   R*   (   R   RC  RY  RZ  RD  R[  R\  t   nlistt   nsegR]  R^  (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyRB  ¯  s&    	


c         C  sa  |  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 rD|  j d k rDt j | d k | ƒ } t j d ƒ | j ƒ  |  _ n  |  j | | ƒ | | | f S(   NR’  R“  i   i    t   dtypei   i   i   s&   Too many arguments to %s; see help(%s)Ri  s,   Log scale: values of z <= 0 have been masked(   R  R)   R   R�   R   R•  t   _initialize_x_yt
   _check_xyzR2   t   masked_invalidR%   R€  R|  R  R}  R6  t   masked_whereRE  RF  R*  R˜  (   R   RR   RS   R–  t   NargsR�  R   R   (    (    sL   /opt/xtal/ccp4-6.5-linux32/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 ƒ ‚ n | j
 \ } } | j | j k rí t	 d ƒ ‚ n  | j d k re| j
 \ } | j
 \ }	 | | k r/t	 d	 ƒ ‚ n  |	 | k rJ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(   s   
        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   ydataRS   R½  s   Input z must be a 2D array.s-   Number of dimensions of x and y should match.i   s+   Length of x must be number of columns in z.s(   Length of y must be number of rows in z.s>   Shape of x does not match that of z: found {0} instead of {1}.s>   Shape of y does not match that of z: found {0} instead of {1}.s    Inputs x and y must be 1D or 2D.(   R�   t   _process_unit_infot   convert_xunitst   convert_yunitsR   R�   R•  R   t   ndimR2   t   shapet   meshgridt   format(
   R   RR   RS   R   R   R�  t   Nyt   Nxt   nxt   ny(    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR¿  â  s:    			c         C  s—  | j  d k r t d ƒ ‚ n | j \ } } |  j d k r¿ |  j d k rm 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
 | | ƒ | }
 t
 | | ƒ | } | t j | ƒ d |
 } | t j | ƒ d | }	 |  j d k r‡|	 d d d … }	 n  t j | |	 ƒ S(   s  
        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   s   Input must be a 2D array.i    g      à?R(  Niÿÿÿÿ(   RÈ  R2   RÉ  R  R#   R   R   RÊ  RÄ   t   linspaceR;   (   R   R�  RÌ  RÍ  R¶  R·  R¸  R¹  R   R   RÜ   RÝ   (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR¾    s(    "!s£  
        Plot contours.

        :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.

        :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`.


        Call signatures::

          contour(Z)

        make a contour plot of an array *Z*. The level values are chosen
        automatically.

        ::

          contour(X,Y,Z)

        *X*, *Y* specify the (x, y) coordinates of the surface

        ::

          contour(Z,N)
          contour(X,Y,Z,N)

        contour *N* automatically-chosen levels.

        ::

          contour(Z,V)
          contour(X,Y,Z,V)

        draw contour lines at the values specified in sequence *V*

        ::

          contourf(..., V)

        fill the ``len(V)-1`` regions between the values in *V*

        ::

          contour(Z, **kwargs)

        Use keyword args to control colors, linewidth, origin, cmap ... see
        below for more details.

        *X* and *Y* must both be 2-D with the same shape as *Z*, or they
        must both be 1-D such that ``len(X)`` is the number of columns in
        *Z* and ``len(Y)`` is the number of rows in *Z*.

        ``C = contour(...)`` returns a
        :class:`~matplotlib.contour.QuadContourSet` object.

        Optional keyword arguments:

          *colors*: [ *None* | string | (mpl_colors) ]
            If *None*, the colormap specified by cmap will be used.

            If a string, like 'r' or 'red', all levels will be plotted in this
            color.

            If a tuple of matplotlib color args (string, float, rgb, etc),
            different levels will be plotted in different colors in the order
            specified.

          *alpha*: float
            The alpha blending value

          *cmap*: [ *None* | Colormap ]
            A cm :class:`~matplotlib.colors.Colormap` instance or
            *None*. If *cmap* is *None* and *colors* is *None*, a
            default Colormap is used.

          *norm*: [ *None* | Normalize ]
            A :class:`matplotlib.colors.Normalize` instance for
            scaling data values to colors. If *norm* is *None* and
            *colors* is *None*, the default linear scaling is used.

          *vmin*, *vmax*: [ *None* | scalar ]
            If not *None*, either or both of these values will be
            supplied to the :class:`matplotlib.colors.Normalize`
            instance, overriding the default color scaling based on
            *levels*.

          *levels*: [level0, level1, ..., leveln]
            A list of floating point numbers indicating the level
            curves to draw; eg to draw just the zero contour pass
            ``levels=[0]``

          *origin*: [ *None* | 'upper' | 'lower' | 'image' ]
            If *None*, the first value of *Z* will correspond to the
            lower left corner, location (0,0). If 'image', the rc
            value for ``image.origin`` will be used.

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

          *extent*: [ *None* | (x0,x1,y0,y1) ]

            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*: [ *None* | ticker.Locator subclass ]
            If *locator* is *None*, the default
            :class:`~matplotlib.ticker.MaxNLocator` is used. The
            locator is used to determine the contour levels if they
            are not given explicitly via the *V* argument.

          *extend*: [ 'neither' | 'both' | 'min' | 'max' ]
            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*: [ *None* | registered units ]
            Override axis units by specifying an instance of a
            :class:`matplotlib.units.ConversionInterface`.

          *antialiased*: [ *True* | *False* ]
            enable antialiasing, overriding the defaults.  For
            filled contours, the default is *True*.  For line contours,
            it is taken from rcParams['lines.antialiased'].

        contour-only keyword arguments:

          *linewidths*: [ *None* | number | tuple of numbers ]
            If *linewidths* is *None*, the default width in
            ``lines.linewidth`` in ``matplotlibrc`` is used.

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

            If a tuple, different levels will be plotted with different
            linewidths in the order specified

          *linestyles*: [ *None* | 'solid' | 'dashed' | 'dashdot' | 'dotted' ]
            If *linestyles* is *None*, the default is 'solid' unless
            the lines are monochrome.  In that case, negative
            contours will take their linestyle from the ``matplotlibrc``
            ``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.

        contourf-only keyword arguments:

          *nchunk*: [ 0 | integer ]
            If 0, no subdivision of the domain. Specify a positive integer to
            divide the domain into subdomains of roughly *nchunk* by *nchunk*
            points. This may never actually be advantageous, so this option may
            be removed. Chunking introduces artifacts at the chunk boundaries
            unless *antialiased* is *False*.

          *hatches*:
            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.


        Note: 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.

        **Examples:**

        .. plot:: mpl_examples/pylab_examples/contour_demo.py

        .. plot:: mpl_examples/pylab_examples/contourf_demo.py
        (
   R   R   R   R@  R;  RB  R©  R¿  R¾  t   contour_doc(    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyR¨  i  s   		'			5	ç(4   R   t
   __future__R    R   RE  t
   matplotlibR8  t   numpyR   R   t   matplotlib._cntrR¬  t   matplotlib.patht   pathRð   t   matplotlib.tickerR4  t   matplotlib.cmRB   t   matplotlib.colorsR   t   matplotlib.collectionsRë   RI  t   matplotlib.font_managerR5   t   matplotlib.textR   t   matplotlib.cbookRF   t   matplotlib.mlabR»   t   matplotlib.mathtextR‚   t   matplotlib.patchest   patchesRn  t   matplotlib.texmanagerR   t   matplotlib.transformst
   transformsRe  t   matplotlib.blocking_inputR   R   R   R   R  R  RC   R  R¨  (    (    (    sL   /opt/xtal/ccp4-6.5-linux32/lib/python2.7/site-packages/matplotlib/contour.pyt   <module>   s<   
ÿ ÿ €		!ÿ ÿ €