
H_Gc           @   sV  d  d k  l Z d  d k Z d  d k Z d  d k Z d  d k i Z d  d k	 i
 Z
 d  d k i Z d  d k i Z d  d k i Z d  d k i Z d  d k i Z d  d k	 i
 Z
 d  d k l Z d  d k Z d e
 i d <d e
 i f d     YZ d e f d     YZ d	 e f d
     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ d e f d     YZ  d e f d     YZ! d e f d     YZ" d   Z# d e f d     YZ$ d e$ f d     YZ% d d# d     YZ& d e( d   Z) d! d d"  Z* e
 i+ e  e
 i d <Z, x d$ D] Z- e, e
 i e- <q;Wd S(%   i(   t   divisionN(   t
   transformssw            alpha: float
          animated: [True | False]
          antialiased or aa: [True | False]
          clip_box: a matplotlib.transform.Bbox instance
          clip_on: [True | False]
          edgecolor or ec: any matplotlib color
          facecolor or fc: any matplotlib color
          figure: a matplotlib.figure.Figure instance
          fill: [True | False]
          hatch: unknown
          label: any string
          linewidth or lw: float
          lod: [True | False]
          transform: a matplotlib.transform transformation instance
          visible: [True | False]
          zorder: any number
          t   Patchc           B   s/  e  Z d  Z d Z d   Z d d d d d d d  Z e i e i  e	 i
 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   Z d   Z d d  Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" RS(   s   
    A patch is a 2D thingy with a face color and an edge color

    If any of edgecolor, facecolor, linewidth, or antialiased are
    None, they default to their rc params setting

    i   c         C   s   t  |  i  i d  d S(   Nt   .i(   t   strt	   __class__t   split(   t   self(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   __str__0   s    c         K   s   t  i i |   | d j o t i d } n | d j o t i d } n | d j o t i d } n | d j o t i d } n | |  _ | |  _ | |  _ | |  _	 | |  _
 | |  _ t |  o t  i |  |  n d S(   sP   
        The following kwarg properties are supported
        %(Patch)s
        s   patch.edgecolors   patch.facecolors   patch.linewidths   patch.antialiasedN(   t   artistt   Artistt   __init__t   Nonet   mplt   rcParamst
   _edgecolort
   _facecolort
   _linewidtht   _antialiasedt   _hatcht   fillt   lent   setp(   R   t	   edgecolort	   facecolort	   linewidtht   antialiasedt   hatchR   t   kwargs(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   3   s    						c         C   s   t  |  i  o |  i |  |  Sn yV |  i   i | i | i f  \ } } |  i   } t i | | |  } | h  f SWn t	 j
 o t
 h  f Sn Xd S(   sU   Test whether the mouse event occurred in the patch.

        Returns T/F, {}
        N(   t   callablet	   _containst   get_transformt   inverse_xy_tupt   xt   yt	   get_vertst   nxutilst   pnpolyt
   ValueErrort   False(   R   t
   mouseeventR!   R"   t   xyvertst   inside(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   containsS   s    $'c         C   s   t  i i |  |  |  i | i    |  i | i    |  i | i    |  i	 | i
    |  i | i    |  i | i    |  i | i    |  i | i    d  S(   N(   R	   R
   t   update_fromt   set_edgecolort   get_edgecolort   set_facecolort   get_facecolort   set_fillt   get_fillt	   set_hatcht	   get_hatcht   set_linewidtht   get_linewidtht   set_transformR   t
   set_figuret
   get_figuret	   set_alphat	   get_alpha(   R   t   other(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR,   d   s    c         C   s   |  i  S(   N(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_antialiasedp   s    c         C   s   |  i  S(   N(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR.   s   s    c         C   s   |  i  S(   N(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR0   v   s    c         C   s   |  i  S(   N(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR6   y   s    c         C   s   | |  _  d S(   s[   
        Set whether to use antialiased rendering

        ACCEPTS: [True | False]
        N(   R   (   R   t   aa(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_antialiased|   s    c         C   s   | |  _  d S(   sQ   
        Set the patch edge color

        ACCEPTS: any matplotlib color
        N(   R   (   R   t   color(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR-      s    c         C   s   | |  _  d S(   sQ   
        Set the patch face color

        ACCEPTS: any matplotlib color
        N(   R   (   R   R@   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR/      s    c         C   s   | |  _  d S(   sK   
        Set the patch linewidth in points

        ACCEPTS: float
        N(   R   (   R   t   w(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR5      s    c         C   s   | |  _  d S(   sP   
        Set whether to fill the patch

        ACCEPTS: [True | False]
        N(   R   (   R   t   b(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR1      s    c         C   s   |  i  S(   s   return whether fill is set(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR2      s    c         C   s   | |  _  d S(   sK  
        Set the hatching pattern

        hatch can be one of:
        /   - diagonal hatching
        \   - back diagonal
        |   - vertical
        -   - horizontal
        #   - crossed
        x   - crossed diagonal
        letters can be combined, in which case all the specified
        hatchings are done
        if same letter repeats, it increases the density of hatching
        in that direction

        CURRENT LIMITATIONS:
        1. Hatching is supported in the PostScript
        backend only.

        2. Hatching is done with solid black lines of width 0.
        N(   R   (   R   t   h(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR3      s    c         C   s   |  i  S(   s#   return the current hatching pattern(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR4      s    c         C   sn  |  i    p d  Sn | i   } t i |  i  o' |  i i   d j o | i d  n! | i |  i  | i |  i  | i	 |  i
  | i |  i  |  i |  | i d  |  i p9 |  i d  j p) t i |  i  o  |  i i   d j o
 d  } n t i i |  i  } |  i o | i |  i  n |  i   } |  i   i |  } | i | | |  d  S(   Nt   nonei    t
   projecting(   t   get_visiblet   new_gct   cbookt   is_string_likeR   t   lowerR5   t   set_foregroundR   R:   t   _alphaR?   R   t   _set_gc_clipt   set_capstyleR   R   R   t   colorst   colorConvertert   to_rgbR   R3   R#   R   t   seq_xy_tupst   draw_polygon(   R   t   renderert   gct   rgbFacet   vertst   tverts(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   draw   s&    ))

c         C   s   t  d   d S(   s2   
        Return the vertices of the patch
        s   Derived must overrideN(   t   NotImplementedError(   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#      s    c         C   s.   |  i    } |  i   i |  } t i |  S(   N(   R#   R   RR   R   t   bound_vertices(   R   RT   RW   RX   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_window_extent   s    c         C   s   |  i  |  d S(   s   alias for set_linewidthN(   R5   (   R   t   val(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_lw   s    c         C   s   |  i  |  d S(   s   alias for set_edgecolorN(   R-   (   R   R]   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_ec   s    c         C   s   |  i  |  d S(   s   alias for set_facecolorN(   R/   (   R   R]   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_fc   s    c         C   s
   |  i    S(   s   alias for get_antialiased(   R=   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_aa  s    c         C   s
   |  i    S(   s   alias for get_linewidth(   R6   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_lw  s    c         C   s
   |  i    S(   s   alias for get_edgecolor(   R.   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_ec  s    c         C   s
   |  i    S(   s   alias for get_facecolor(   R0   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_fc  s    N(#   t   __name__t
   __module__t   __doc__t   zorderR   R   R   RH   t   dedentR	   t   kwdocdR+   R,   R=   R.   R0   R6   R?   R-   R/   R5   R1   R2   R3   R4   RY   R#   R\   R^   R_   R`   Ra   Rb   Rc   Rd   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   '   sD   																!							t   Shadowc           B   sT   e  Z d    Z d d  Z e i e i  e i	 e _ d   Z
 d   Z d   Z RS(   c         C   s   d t  |  i  S(   Ns
   Shadow(%s)(   R   t   patch(   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    c         K   s@   t  i |   | | |  _ |  _ | |  _ | |  _ |  i   d S(   s   
        Create a shadow of the patch offset by ox, oy.  props, if not None is
        a patch property update dictionary.  If None, the shadow will have
        have the same color as the face, but darkened

        kwargs are
        %(Patch)s
        N(   R   R   t   oxt   oyRl   t   propst   _update(   R   Rl   Rm   Rn   Ro   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s
    			c         C   s   |  i  |  i  |  i d  j	 o |  i |  i  nx t i i |  i i    \ } } } } d } | | } | | } | | } |  i	 | | | f  |  i
 | | | f  d  S(   Ng333333?(   R,   Rl   Ro   R   t   updateRO   RP   t   to_rgbaR0   R/   R-   (   R   t   rt   gRB   t   at   rho(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyRp   ,  s    '


c         C   s   |  i  i   } |  i g  } | D] \ } } | | |  i q  ~  } |  i g  } | D] \ } } | | |  i qW ~  } t | |  S(   N(   Rl   R#   t   convert_xunitsRm   t   convert_yunitsRn   t   zip(   R   RW   t   _[1]R!   R"   t   xst   _[2]t   ys(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#   :  s    77c         C   s   |  i    t i |  |  d S(   s   draw the shadowN(   Rp   R   RY   (   R   RT   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   _draw@  s    
N(   Re   Rf   R   R   R   RH   Ri   Rg   R	   Rj   Rp   R#   R~   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyRk     s   			t	   Rectanglec           B   s   e  Z d  Z d   Z d   Z e i e i  e i e _ d   Z	 d   Z
 d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z RS(   s[   
    Draw a rectangle with lower left at xy=(x,y) with specified
    width and height

    c         C   sB   t  |  i  i d  d d |  i d |  i d |  i |  i f S(   NR   is   (%g,%g;%gx%g)i    i   (   R   R   R   t   xyt   widtht   height(   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   L  s    c         K   s6   t  i |  |  t |  |  _ | | |  _ |  _ d S(   s   
        xy is an x,y tuple lower, left

        width and height are width and height of rectangle

        fill is a boolean indicating whether to fill the rectangle

        Valid kwargs are:
        %(Patch)s
        N(   R   R   t   listR   R   R   (   R   R   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   P  s    c         C   s   |  i  \ } } |  i |  } |  i | |  i  } |  i |  } |  i | |  i  } | | f | | f | | f | | f f S(   s6   
        Return the vertices of the rectangle
        (   R   Rw   R   Rx   R   (   R   R!   R"   t   leftt   rightt   bottomt   top(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#   d  s    c         C   s   |  i  d S(   s&   Return the left coord of the rectanglei    (   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_xr  s    c         C   s   |  i  d S(   s(   Return the bottom coord of the rectanglei   (   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_yv  s    c         C   s   |  i  S(   s"   Return the width of the  rectangle(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt	   get_widthz  s    c         C   s   |  i  S(   s"   Return the height of the rectangle(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt
   get_height~  s    c         C   s   | |  i  d <d S(   sM   
        Set the left coord of the rectangle

        ACCEPTS: float
        i    N(   R   (   R   R!   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_x  s    c         C   s   | |  i  d <d S(   sO   
        Set the bottom coord of the rectangle

        ACCEPTS: float
        i   N(   R   (   R   R"   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   set_y  s    c         C   s   | |  _  d S(   sA   
        Set the width rectangle

        ACCEPTS: float
        N(   R   (   R   RA   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt	   set_width  s    c         C   s   | |  _  d S(   sA   
        Set the width rectangle

        ACCEPTS: float
        N(   R   (   R   RC   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt
   set_height  s    c         G   sd   t  |  d j o | d \ } } } } n | \ } } } } | | g |  _ | |  _ | |  _ d S(   sj   
        Set the bounds of the rectangle: l,b,w,h

        ACCEPTS: (left, bottom, width, height)
        i    N(   R   R   R   R   (   R   t   argst   lRB   RA   RC   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt
   set_bounds  s    	(   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   R#   R   R   R   R   R   R   R   R   R   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   E  s   											t   RegularPolygonc           B   sK   e  Z d  Z d   Z d d d  Z e i e i  e i e _ d   Z	 RS(   s"   
    A regular polygon patch.
    c         C   s"   d |  i  |  i d |  i d f S(   Ns   Poly%d(%g,%g)i    i   (   t   numVerticesR   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    i   i    c         K   s>   t  i |  |  t |  |  _ | |  _ | |  _ | |  _ d S(   s  
        xy is a length 2 tuple (the center)
        numVertices is the number of vertices.
        radius is the distance from the center to each of the vertices.
        orientation is in radians and rotates the polygon.

        Valid kwargs are:
        %(Patch)s
        N(   R   R   R   R   R   t   radiust   orientation(   R   R   R   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s
    		c         C   s   d t  i |  i t  i |  i  |  i } t |  i  } t t |  i  \ } } | | t  i	 |  } | | t  i
 |  } t | |  |  _ |  i S(   Ni   (   t   npyt   piR   t   arangeR   t   floatR   t   mapR   t   cost   sinRy   RW   (   R   t   thetaRs   R!   R"   R{   R}   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#     s    !
(
   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   R#   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s
   	t   Polygonc           B   sE   e  Z d  Z d   Z d   Z e i e i  e i e _ d   Z	 RS(   s"   
    A general polygon patch.
    c         C   s   d |  i  d S(   Ns   Poly(%g,%g)i    (   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    c         K   s=   t  i |  |  t | t  p t |  } n | |  _ d S(   s   
        xy is a sequence of (x,y) 2 tuples

        Valid kwargs are:
        %(Patch)s
        See Patch documentation for additional kwargs
        N(   R   R   t
   isinstanceR   R   (   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    	c         C   sD   t  |  i   d  \ } } |  i |  } |  i |  } t  | |  S(   Ni   (   Ry   R   Rw   Rx   (   R   R{   R}   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#     s    (
   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   R#   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s
   		t   Wedgec           B   s9   e  Z d    Z d d  Z e i e i  e i e _ RS(   c         C   s   d |  i  d S(   Ns   Wedge(%g,%g)i    (   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    g      @c         K   s   | \ } } t  |  } t  |  } t  |  } t | |  | }	 t i d t i | | |	 d t }
 | t i |
  | } | t i |
  | } | g } | i g  } t	 | |  D] \ } } | | | f q ~  t
 i |  | |  d S(   s   
        Draw a wedge centered at x,y tuple center with radius r that
        sweeps theta1 to theta2 (angles)

        dtheta is the resolution in degrees

        Valid kwargs are:
        %(Patch)s

        g     f@t   endpointN(   R   t   absR   R   t   linspacet   TrueR   R   t   extendRy   R   R   (   R   t   centerRs   t   theta1t   theta2t   dthetaR   t   xct   yct
   num_pointst   radsR{   R}   RW   Rz   R!   R"   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    &	=(	   Re   Rf   R   R   RH   Ri   Rg   R	   Rj   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s   	t   Arrowc           B   s?   e  Z d  Z d   Z d d  Z e i e i  e i e _ RS(   s   
    An arrow patch
    c         C   sQ   |  i  d \ } } |  i  d \ } } | | d | | d } } d | | f S(   Ni    i   g       @s   Arrow(%g,%g)(   R   (   R   t   x1t   y1t   x2t   y2t   cxt   cy(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    g      ?c      	   K   s>  t  i d d g d d g d d g d d g d d g d d g d d g g  } t  i | d | d  p d	 } | d
 d
  d f c | 9<| d
 d
  d	 f c | 9<t |  | }	 t |  | }
 t  i |	 |
 g |
 |	 g g  } t  i | |  | | g } t i |  g  } | D] } | t |  q~ |  d
 S(   s   Draws an arrow, starting at (x,y), direction and length
        given by (dx,dy) the width of the arrow is scaled by width

        Valid kwargs are:
        %(Patch)s
          g        g?gg?g333333ӿg      ?g333333?i   i   Ni    (   R   t   arrayt   sqrtR   t   dotR   R   t   tuple(   R   R!   R"   t   dxt   dyR   R   t   arrowt   LR   t   sxt   MRW   Rz   t   t(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   %  s    ""(	   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s   	t
   FancyArrowc           B   sQ   e  Z d  Z d   Z d e d d d d e d  Z e i e i  e	 i
 e _ RS(   sF   Like Arrow, but lets you set head width and head height independently.c         C   sQ   |  i  d \ } } |  i  d \ } } | | d | | d } } d | | f S(   Ni    i   g       @s   FancyArrow(%g,%g)(   R   (   R   R   R   R   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   >  s    gMbP?t   fulli    c         K   s0  | d j o d | } n | d j o d | } n t i | d | d  } | o
 | } n | | } | p
 g  } n| | |
 | f \ } } } } t i d d g | | d g | d | | d g | | d g | d g g  } | p | | d g 7} n | o | | d d g 7} n |	 d j o
 | } nh | d d	 g } |	 d
 j o
 | } nA |	 d j o& t i | | d d d	  g  } n t d |	  t |  | } t |  | } t i | | g | | g g  } t i | |  | | | | f } t i	 |  t
 t |  |  d S(   s  Returns a new Arrow.

        length_includes_head: True if head is counted in calculating the length.

        shape: ['full', 'left', 'right']

        overhang: distance that the arrow is swept back (0 overhang means
        triangular shape).

        head_starts_at_zero: if True, the head starts being drawn at coordinate
        0 instead of ending at coordinate 0.

        Valid kwargs are:
        %(Patch)s

        i   g      ?i   g        g       @i   i    R   iR   R   Ns   Got unknown shape: %s(   R   R   R   R   t   concatenateR&   R   R   R   R   R   R   (   R   R!   R"   R   R   R   t   length_includes_headt
   head_widtht   head_lengtht   shapet   overhangt   head_starts_at_zeroR   t   distancet   lengthRW   t   hwt   hlt   hst   lwt   left_half_arrowt   coordst   right_half_arrowR   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   D  sD    


	

&"$N(   Re   Rf   Rg   R   R'   R   R   RH   Ri   R	   Rj   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   ;  s   	>t   YAArrowc           B   sW   e  Z d  Z d   Z d d d d  Z e i e i  e i e _ d   Z	 d   Z
 RS(   s   
    Yet another arrow class

    This is an arrow that is defined in display space and has a tip at
    x1,y1 and a base at x2, y2.
    c         C   sQ   |  i  d \ } } |  i  d \ } } | | d | | d } } d | | f S(   Ni    i   g       @s   YAArrow(%g,%g)(   R   (   R   R   R   R   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    i   g?i   c   	      K   sY   | |  _  | |  _ | |  _ | |  _ | |  _ | |  _ |  i   } t i |  | |  d S(   s  
        xytip : (x,y) location of arrow tip
        xybase : (x,y) location the arrow base mid point
        dpi : the figure dpi instance (fig.dpi)
        width : the width of the arrow in points
        frac  : the fraction of the arrow length occupied by the head
        headwidth : the width of the base of the arrow head in points

        Valid kwargs are:
        %(Patch)s

        N(	   t   dpit   xytipt   xybaseR   t   fract	   headwidthR#   R   R   (	   R   R   R   R   R   R   R   R   RW   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    						c         C   s  |  i  \ } } |  i \ } } |  i |  i i   d d } |  i |  i i   d d } |  i | | | | |  \ } } }	 }
 t i | | | |  } t i	 | | d | | d  } | |  i
 | t i |  } | |  i
 | t i |  } |  i | | | | |  \ } } } } |  i | | | | |  \ } } } } |  i | |	 | | | | | g  } |  i | |
 | | | | | g  } t | |  S(   Ng      R@g       @(   R   R   R   R   t   getR   t	   getpointst   matht   atan2R   R   R   R   Rw   Rx   Ry   (   R   R   R   R   R   t   k1t   k2t   xb1t   yb1t   xb2t   yb2R   Rs   t   xmt   ymt   xc1t   yc1t   xc2t   yc2t   xd1t   yd1t   xd2t   yd2R{   R}   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#     s    '#''$$c         C   s  t  t | | | | | f  \ } } } } } | | | | } d | } d } d | }	 | d | d | d d | d }
 |	 t i |	 d d | |
  d | } | | | | } |	 t i |	 d d | |
  d | } | | | | } | | | | f S(   s   
        for line segment defined by x1,y1 and x2,y2, return the points on
        the line that is perpendicular to the line and intersects x2,y2
        and the distance from x2,y2 ot the returned points is k
        g      i   ig       @g      ?i   (   R   R   R   R   (   R   R   R   R   R   t   kt   mt   pmRu   RB   t   ct   y3at   x3at   y3bt   x3b(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    -

&,,(   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   R#   R   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s   		t   CirclePolygonc           B   sB   e  Z d  Z d   Z d d d  Z e i e i  e i e _ RS(   s   
    A circle patch
    c         C   s   d |  i  S(   Ns   CirclePolygon(%d,%d)(   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    i   i   c         K   s5   | |  _  | |  _ t i |  | | | d d | d S(   sy   
        Create a circle at xy=(x,y) with radius given by 'radius'

        Valid kwargs are:
        %(Patch)s

        R   i    N(   R   R   R   R   (   R   R   R   t
   resolutionR   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    
		(	   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s
   	c         C   s   |  | | | }  } t  i |  |  t  i |  } |  |  | | } | t  i |  }	 | t  i |  }
 | | | | |
 |
 |	 |	 } | | j S(   N(   R   R   t   radiansR   R   (   R!   R"   R   R   Ru   RB   t   angleR   t   rsqt   asint   bcost   Rsq(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt	   inellipse  s    "t   Ellipsec           B   s  e  Z d  Z d Z e i d  Z e i e e d  Z e i d d g e d g e e e e g e e g e e e e g d e g d d g d e g e e e e g e e g e e e e g e d g d d g e d g e e e e g e e g e e e e g d e g d d g d e g e e e e g e e g e e e e g e d g d d g g e i	  Z
 d   Z d d  Z d	   Z d
   Z d   Z RS(   s   
    A scale-free ellipse
    grSl?g      ?g       @g        g      g      ?c         C   s(   d |  i  d |  i  d |  i |  i f S(   Ns   Ellipse(%d,%d;%dx%d)i    i   (   R   R   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   '  s    c         K   s9   t  i |  |  | |  _ | | |  _ |  _ | |  _ d S(   s   
        xy - center of ellipse
        width - length of horizontal axis
        height - length of vertical axis
        angle - rotation in degrees (anti-clockwise)

        Valid kwargs are:
        %(Patch)s
        N(   R   R   R   R   R   R   (   R   R   R   R   R   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR   *  s    
	c         C   s{   | i  d  j p | i d  j o t h  f Sn t | i  | i |  i d |  i d |  i d |  i d |  i  } | h  f S(   Ni    i   g      ?(	   t   xdataR   t   ydataR'   R   R   R   R   R   (   R   t   evR*   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR+   ;  s
    . c         C   sT  |  i  \ } } |  i |  i } } |  i |  } |  i |  } |  i |  } |  i |  } |  i } t i d d d  t i d } | d t i	 |  } | d t i
 |  } | t i d }	 t i t i	 |	  t i
 |	  g t i
 |	  t i	 |	  g g  }
 t i |
 t i | | g   \ } } | | 7} | | 7} t | |  S(   Ng        g     v@g      ?g     f@g       @(   R   R   R   Rw   Rx   R   R   R   R   R   R   R   R   Ry   (   R   t   xcentert   ycenterR   R   R   R   R!   R"   t   rthetat   R(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#   B  s$    	 $'

c         C   s  |  i    p d  Sn | i   } | i |  i  | i |  i  | i |  i  | i |  i	  |  i
 |  | i d  |  i p |  i d  j o
 d  } n t i i |  i  } |  i o | i |  i  n t | d  p1 t i i d  | i | | |  i    d  Sn |  i \ } } |  i |  } |  i |  } |  i |  i  d } |  i |  i  d } |  i t  i! d } t  i" d d | g d d | g d d d g g  }	 t  i" | d d g d | d g d d d g g  }
 t  i" t  i# |  t  i$ |  d g t  i$ |  t  i# |  d g d d d g g  } t  i% |	 t  i% | |
   } |  i&   i'   \ } } } } } } t  i" | | | g | | | g d d d g g t  i(  } t  i% | |  } t  i) d t* |  i+  f  } |  i+ i, | d d	  d  d   f <t  i% | |  i, d  d   d  d	  f } t- i.   } | i/ | d   x5 t0 d d
 d  D]! } | i1 | | | d !i2   qgW| i3   | i4 | | |  d  S(   NRE   t	   draw_pathsy   patches.Ellipse renderer does not support path drawing; falling back on vertex approximation for nonlinear transformationg       @g     f@i   i    i   i   i   (5   RF   RG   RK   R   R5   R   R:   RL   R?   R   RM   RN   R   R   R   RO   RP   RQ   R   R3   t   hasattrR   t   verboset   reportRS   R#   R   Rw   Rx   R   R   R   R   R   R   R   R   R   R   t   as_vec6_valt   float_t   onesR   t   circlet   Tt   aggt   path_storaget   move_tot   ranget   curve4t   flatt   close_polygonR  (   R   RT   RU   RV   R!   R"   RA   RC   R   R  t   SR  t   ER   RB   R   t   syt   txt   tyt   DR   t   Ct   ellipset   patht   i(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyRY   a  sf    %
$"+ 
(   Re   Rf   Rg   t   MAGICR   R   t   SQRTHALFt   MAGIC45R   R  R  R   R   R+   R#   RY   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     sH   		

					

		

			t   Circlec           B   s?   e  Z d  Z d   Z d d  Z e i e i  e i e _ RS(   s   
    A circle patch
    c         C   s"   d |  i  d |  i  d |  i f S(   Ns   Circle((%g,%g),r=%g)i    i   (   R   R   (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    i   c         K   sk   | i  d  o- d d k } | i d t  | i d  n | |  _ t i |  | | d | d |  d S(   s   
        Create true circle at center xy=(x,y) with given radius;
        unlike circle polygon which is a polygonal approcimation, this
        uses splines and is much closer to a scale free circle

        Valid kwargs are:
        %(Patch)s

        R   iNs5   Circle is now scale free.  Use CirclePolygon instead!i   (   t   has_keyt   warningst   warnt   DeprecationWarningt   popR   R   R   (   R   R   R   R   R%  (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    	(	   Re   Rf   Rg   R   R   RH   Ri   R	   Rj   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR#    s   	t   PolygonInteractorc           B   sb   e  Z d  Z e Z d Z d   Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d	   Z RS(
   sC  
    An polygon editor.

    Key-bindings

      't' toggle vertex markers on and off.  When vertex markers are on,
          you can move them, delete them

      'd' delete the vertex under point

      'i' insert a vertex at point.  You must be within epsilon of the
          line connecting two existing vertices

    i   c         C   s   d S(   NR)  (    (   R   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    c         C   s   | i  d  j o t d   n | i  i } | |  _ t |  i i    |  i _ t |  i i   \ } } t	 i
 | | d d d d |  _ |  i i |  i  } d  |  _ | i d |  i  | i d |  i  | i d |  i  | i d	 |  i  | |  _ d  S(
   NsS   You must first add the polygon to a figure or canvas before defining the interactort   markert   ot   markerfacecolorRs   t   button_press_eventt   key_press_eventt   button_release_eventt   motion_notify_event(   t   figureR   t   RuntimeErrort   canvast   polyR   R#   RW   Ry   t   linest   Line2Dt   linet   add_callbackt   poly_changedt   _indt   mpl_connectt   button_press_callbackt   key_press_callbackt   button_release_callbackt   motion_notify_callback(   R   R4  R3  R!   R"   t   cid(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR     s    	!	c         C   s9   |  i  i   } t i i |  i  |  |  i  i |  d S(   s;   this method is called whenever the polygon object is calledN(   R7  RF   R	   R
   R,   t   set_visible(   R   R4  t   vis(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR9    s    c         C   s   t  |  i i   \ } } |  i i   i | |  \ } } t i | | i d | | i d  } t i	 t i
 | t i |    \ } | | |  i j o
 d } n | S(   sC   get the index of the vertex under point if within epsilon tolerancei   N(   Ry   R4  RW   R   t   numerix_x_yR   R   R!   R"   t   nonzerot   equalt   amint   epsilonR   (   R   t   eventR!   R"   t   xtt   ytt   dt   ind(    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   get_ind_under_point  s    !)'
c         C   sX   |  i  p d Sn | i d j o d Sn | i d j o d Sn |  i |  |  _ d S(   s"   whenever a mouse button is pressedNi   (   t	   showvertst   inaxesR   t   buttonRM  R:  (   R   RH  (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR<    s    c         C   s7   |  i  p d Sn | i d j o d Sn d |  _ d S(   s#   whenever a mouse button is releasedNi   (   RN  RP  R   R:  (   R   RH  (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR>    s    c         C   s  | i  p d Sn | i d j o; |  i |  _ |  i i |  i  |  i p d |  _ qn| i d j o |  i |  } | d j	 oj g  } t |  i	 i
  D]$ \ } } | | j o | | q q ~ |  i	 _
 |  i i t |  i	 i
    qn | i d j o |  i	 i   i |  i	 i
  } | i | i f } x t t |  d  D] } | | } | | d }	 t i | | |	  }
 |
 |  i j oG |  i	 i
 i | d | i | i f  |  i i t |  i	 i
    PqNqNWn |  i i   d S(   s   whenever a key is pressedNR   RK  R  i   (   RO  t   keyRN  R7  RA  R   R:  RM  t	   enumerateR4  RW   t   set_dataRy   R   RR   R!   R"   R  R   t   mlabt   dist_point_to_segmentRG  t   insertR   R   R3  RY   (   R   RH  RL  Rz   R  t   tupt   xyst   pt   s0t   s1RK  (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR=    s.    J$ 
&c         C   s   |  i  p d Sn |  i d j o d Sn | i d j o d Sn | i d j o d Sn | i | i } } | | f |  i i |  i <|  i	 i
 t |  i i    |  i i   d S(   s   on mouse movementNi   (   RN  R:  R   RO  RP  R   R   R4  RW   R7  RS  Ry   R3  t	   draw_idle(   R   RH  R!   R"   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR?  8  s    (   Re   Rf   Rg   R   RN  RG  R   R   R9  RM  R<  R>  R=  R?  (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyR)    s   							c      	   C   s   | d j o
 h  } n | i   } | i d d  } | i |  } |  i |  } | i   \ } } } }	 | | d 8} | | d 8} | | 7} |	 | 7}	 t d | | f d | d |	 d |  }
 |
 i t  |
 i	 |  |
 i
 |  d S(	   s:  
    This is a debug function to draw a rectangle around the bounding
    box returned by get_window_extent of an artist, to test whether
    the artist is returning the correct bbox

    props is a dict of rectangle props with the additional property
    'pad' that sets the padding around the bbox in points
    t   padi   g       @R   R   R   R   N(   R   t   copyR(  t   points_to_pixelsR\   t
   get_boundsR   t   set_clip_onR'   Rq   RY   (   R	   RT   Ro   R   R]  t   bboxR   RB   RA   RC   Rs   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt   bbox_artistD  s"    	

	R   c   	      C   s   |  i    \ } } } } t d | | f d | d | d | d t  } | d j	 o | i |  n | i t  | i |  d S(   s   
    This is a debug function to draw a rectangle around the bounding
    box returned by get_window_extent of an artist, to test whether
    the artist is returning the correct bbox
    R   R   R   R   R   N(   R`  R   R'   R   R7   Ra  RY   (	   Rb  RT   R@   t   transR   RB   RA   RC   Rs   (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pyt	   draw_bboxa  s    	(    (
   R   R#  R   R   R   R   R   R   R   R   (.   t
   __future__R    R   t
   matplotlibR   t   numpyR   t   matplotlib.cbookRH   t   matplotlib.artistR	   t   matplotlib.colorsRO   t   matplotlib.linesR5  t   matplotlib.transformsR   t   matplotlib.nxutilsR$   t   matplotlib.mlabRT  t   mtransR  Rj   R
   R   Rk   R   R   R   R   R   R   R   R   R   R   R#  R)  R   R   Rc  Re  t   kwdoct   patchdocR   (    (    (    s;   /Users/cmoad/workspace/matplotlib/lib/matplotlib/patches.pys   <module>   sF   .l. KQ		t 