
 m[c           @` sG  d  Z  d d l m Z m Z m Z d d l Z d d l m Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l Z d d l Z d d l m Z m Z m Z m Z d d l m Z d d l m Z d d	 l m Z d d
 l m Z m Z m Z d d l m Z d d l m  Z  m! Z! m" Z" m# Z# m$ Z$ m% Z% e	 j& e'  Z( e) d  Z* e j+ d    Z, d   Z- d   Z. d e f d     YZ/ e j0 j1 d e j2 e/   e j3 e/ j4  d e/ f d     YZ5 e j0 j1 d e j2 e5   d e6 f d     YZ7 d e6 f d     YZ8 d e/ e8 f d     YZ9 e j0 j1 d e9 j4 j   d S(   s)   
Classes for including text in a figure.
i    (   t   absolute_importt   divisiont   print_functionN(   t   zipi   (   t   artistt   cbookt	   docstringt   rcParams(   t   Artist(   t   FontProperties(   t   Line2D(   t   FancyArrowPatcht   FancyBboxPatcht	   Rectangle(   t   TextPath(   t   Affine2Dt   Bboxt   BboxBaset   BboxTransformTot   IdentityTransformt	   Transformc         K` s-   | d k	 r |  j |  n  |  j |  |  S(   sE   Return an override dict.  See :func:`~pyplot.text' docstring for infoN(   t   Nonet   update(   t   overridet   fontdictt   kwargs(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _process_text_args   s    c         c` sQ   |  j    rH |  j   } z |  j |  j    |  VWd |  j |  Xn |  Vd S(   sL   Temporarily inserts newlines to the text if the wrap option is enabled.
    N(   t   get_wrapt   get_textt   set_textt   _get_wrapped_text(   t   textobjt   old_text(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt
   _wrap_text(   s    	c         C` s   y t  |   } Wn t t f k
 r t |  t j  } | rJ |  d k sV |  d k r_ d } q | rz |  d k rz d } q t d j |     n X| d S(   s   
    Return the text angle as float. The returned
    angle is between 0 and 360 deg.

    *rotation* may be 'horizontal', 'vertical', or a numeric value in degrees.
    t
   horizontalg        t   verticalg     V@sM   rotation is {0} expected either 'horizontal' 'vertical', numeric value orNoneih  N(   t   floatt
   ValueErrort	   TypeErrort
   isinstancet   sixt   string_typesR   t   format(   t   rotationt   anglet   isString(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_rotation8   s    			c         C` sL  g  } g  } t  j |  j    } t   j |  } |  j |  \ } } } x | D]~ \ }	 }
 } } |
 \ } } | j | | f  \ } } | | 8} | | | | } } | j | | g  | j | | g  qS Wt |  t |  } } t	 |  | t	 |  | } } t   j |  } | j | | f  \ } } | | | | f S(   s   
    Calculate the bounding box of the text. Unlike
    :meth:`matplotlib.text.Text.get_extents` method, The bbox size of
    the text before the rotation is calculated.
    (
   t   npt   deg2radR.   R   t   rotatet   _get_layoutt   transform_pointt   extendt   mint   max(   t   textt   renderert   projected_xst   projected_yst   thetat   trt   _t   partst   dt   tt   wht   xt   yt   wt   ht   xt1t   yt1t   xt2t   yt2t   xt_boxt   yt_boxt   w_boxt   h_boxt   x_boxt   y_box(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_textboxO   s"    
!t   Textc           B` se  e  Z d  Z d Z e j d  Z d   Z d d d d\ d d d\ d\ d\ d\ d\ 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   Z d   Z d   Z d\ d  Z d   Z d   Z d   Z d   Z d   Z  d   Z! d    Z" e# j$ d!    Z% d"   Z& d#   Z' d$   Z( d%   Z) d&   Z* d'   Z+ d(   Z, d)   Z- d*   Z. d+   Z/ d,   Z0 d-   Z1 d.   Z2 d/   Z3 d0   Z4 d1   Z5 d2   Z6 d3   Z7 d4   Z8 d5   Z9 d6   Z: d\ d7  Z; d8   Z< d9   Z= d:   Z> d\ d\ d;  Z? d<   Z@ d=   ZA d>   ZB d?   ZC d@   ZD dA   ZE dB   ZF dC   ZG dD   ZH dE   ZI dF   ZJ dG   ZK dH   ZL dI   ZM dJ   ZN dK   ZO dL   ZP dM   ZQ dN   ZR dO   ZS dP   ZT dQ   ZU dR   ZV dS   ZW dT   ZX dU   ZY dV   ZZ e[ d\ dW   Z\ dX   Z] dY   Z^ dZ   Z_ d[   Z` RS(]   sK   
    Handle storing and drawing of text in window or data coordinates.
    i   i2   c         C` s    d |  j  |  j t |  j  f S(   Ns   Text(%g,%g,%s)(   t   _xt   _yt   reprt   _text(   t   self(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   __repr__~   s    i    t    t   baselinet   leftc         K` s!  t  j |   | | |  _ |  _ | d k r9 t d } n  | d k rQ t   } n! t | t j	  rr t |  } n  |  j
 |  |  j |  |  j |  |  j |  | |  _ | |  _ | |  _ |	 |  _ | |  _ d |  _ d |  _ |
 d k r d }
 n  |
 |  _ |  j |  |  j |  d S(   s   
        Create a :class:`~matplotlib.text.Text` instance at *x*, *y*
        with string *text*.

        Valid kwargs are
        %(Text)s
        s
   text.colorg333333?N(   R   t   __init__RR   RS   R   R   R	   R'   R(   R)   R   t	   set_colort
   set_usetext   set_wrapt   _verticalalignmentt   _horizontalalignmentt   _multialignmentt	   _rotationt   _fontpropertiest   _bbox_patcht	   _renderert   _linespacingt   set_rotation_modeR   (   RV   RB   RC   R7   t   colort   verticalalignmentt   horizontalalignmentt   multialignmentt   fontpropertiesR+   t   linespacingt   rotation_modet   usetext   wrapR   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR[      s0    									c         C` sQ   t    } | j d |  } t t |   j |  | | k	 rM |  j |  n  d S(   s6   
        Update properties from a dictionary.
        t   bboxN(   t   objectt   popt   superRQ   R   t   set_bbox(   RV   R   t   sentinelRq   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR      s
    	c         C` s#   t  t |   j   } d  | d <| S(   NRe   (   Rt   RQ   t   __getstate__R   (   RV   R?   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRw      s    
c         C` s
  t  |  j  r |  j |  |  S|  j   s; |  j d k rE t i  f S|  j   j \ } } } } | | | | } } | j | j	 } }	 | | k o | k n o | |	 k o | k n }
 i  } |  j
 r |  j
 j |  \ } } |
 p | }
 | | d <n  |
 | f S(   s   Test whether the mouse event occurred in the patch.

        In the case of text, a hit is true anywhere in the
        axis-aligned bounding-box containing the text.

        Returns True or False.
        t
   bbox_patchN(   t   callablet	   _containst   get_visibleRe   R   t   Falset   get_window_extentt   boundsRB   RC   Rd   t   contains(   RV   t
   mouseeventt   lt   bRD   RE   t   rR@   RB   RC   t   insidet   cattrt   patch_insidet   patch_cattr(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR      s    
8	c         C` s+   |  j    \ } } |  j   j | | f  S(   sD   get the (possibly unit converted) transformed x, y in display coords(   t   get_unitless_positiont   get_transformR3   (   RV   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_xy_display   s    c         C` s!   |  j  d  k	 r |  j  S|  j Sd  S(   N(   Ra   R   R`   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_multialignment   s    c         C` s   t  |  j  S(   s)   return the text angle as float in degrees(   R.   Rb   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR.      s    c         C` sG   | d k s | d k r$ | |  _ n t d t |    t |  _ d S(   s  
        Set text rotation mode.

        .. ACCEPTS: [ None | "default" | "anchor" ]

        Parameters
        ----------
        m : ``None`` or ``"default"`` or ``"anchor"``
            If ``None`` or ``"default"``, the text will be first rotated, then
            aligned according to their horizontal and vertical alignments.  If
            ``"anchor"``, then alignment occurs before rotation.
        t   anchort   defaults   Unknown rotation_mode : %sN(   R   R   (   R   t   _rotation_modeR%   RT   t   Truet   stale(   RV   t   m(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRg      s    c         C` s   |  j  S(   s   get text rotation mode(   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_rotation_mode  s    c         C` s   t  j |  |  | j |  _ | j |  _ | j |  _ | j |  _ | j j   |  _ | j |  _ | j	 |  _	 | j
 |  _
 t |  _ d S(   s"   Copy properties from other to selfN(   R   t   update_fromt   _colorRa   R_   R`   Rc   t   copyRb   t   _pickerRf   R   R   (   RV   t   other(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    c   /      C` s]  |  j  d |  } | |  j k r, |  j | Sg  } d \ } } d \ } } d \ } }	 |  j   j d  }
 t j t |
  d f  } t j t |
  d f  } | j d |  j d t	 \ } } } | | |  j
 } d } xt |
  D] \ } } |  j | |  j    \ } } | r@| j | |  j d | \ } } } n d \ } } } t | |  } t | |  } | | f | | <| | | } | t | | | |  j
  8} | | | | f | | <| | 8} t | |  } | } q W| d	 d
 } | d d
 | d d } | | }	 | | } t   j |  j    } t j t |
  d f  } | d d  d d  f | (t |
  d
 k r|  j   } | d k r| d d  d f c | d | d d  d f d 7<q| d k r| d d  d f c | | d d  d f 7<qn  t j | | f | | f | | f | | f g t  } | d d  d
 f c | 8<| j |  } | d d  d f }  | d d  d
 f }! |  j   |  j   } } |! j   |! j   } } | | } | | }	 |  j }" |  j }# |  j   }$ |$ d k r|" d k r/| | d }% n |" d k rH| | }% n | }% |# d k rk| |	 d } q|# d k r| |	 } q|# d k r| |	 | } q|# d k r| |	 | d } q| } n | d \ }& }' | d \ }( }) |" d k r|& |( d }% n |" d k r|( }% n |& }% |# d k r@|' |) d } nU |# d k rU|) } n@ |# d k rn|) | } n' |# d k r|' |) | d } n |' } | j |% | f  \ }% } | |% 8} | | 8} t j | | | |	  }* | j |  }+ |+ |% | f 8}+ |+ d d  d f |+ d d  d
 f }, }- |* t t |
 | |, |-   | f }. |. |  j | <|. S(   s   
        return the extent (bbox) of the text together with
        multiple-alignment information. Note that it returns an extent
        of a rotated text when necessary.
        R8   g        s   
i   i   t   lpt   ismathi    ii   i   Nt   centerg       @t   rightR   t   topRY   t   center_baseline(   g        g        (   g        g        (   g        g        (   i    i    i    (   t   get_prop_tupt   _cachedR   t   splitR/   t   zerost   lent   get_text_width_height_descentRc   R|   Rf   t	   enumeratet   is_math_textt
   get_usetexR6   R   t
   rotate_degR.   R   t   arrayR$   t	   transformR5   R`   R_   R   R3   R   t   from_boundst   listR   (/   RV   R8   t   keyt   horizLayoutt   thisxt   thisyt   xmint   ymint   widtht   heightt   linest   whst   tmpt   lp_ht   lp_blt   offsetyRY   t   it   linet
   clean_lineR   RD   RE   R?   t   descentt   ymaxt   xmaxt   Mt   offsetLayoutt   malignt   cornersHorizt   cornersRotatedt   txst   tyst   halignt   valignRn   t   offsetxt   xmin1t   ymin1t   xmax1t   ymax1Rq   t   xyst   xst   yst   ret(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR2     s    				



;60

					

-$c         C` s  | d k	 r | j   } | j d d  } | j d d  } | d k rv d } | d k rc d } n  | |  j   } n | d k r d } n  t | t j  r d | k r | d | 7} n  | j d d  } t d d	 d	 d | d | d
 t   | |  _	 n	 d |  _	 |  j
   d S(   sp  
        Draw a bounding box around self.  rectprops are any settable
        properties for a FancyBboxPatch, e.g., facecolor='red', alpha=0.5.

          t.set_bbox(dict(facecolor='red', alpha=0.5))

        The default boxstyle is 'square'. The mutation
        scale of the FancyBboxPatch is set to the fontsize.

        ACCEPTS: FancyBboxPatch prop dict
        t   boxstylet   padt   squarei   g333333?s
   ,pad=%0.2ft   bbox_transmuterg        g      ?R   N(   g        g        (   R   R   Rs   t   get_sizeR'   R(   R)   R   R   Rd   t   _update_clip_properties(   RV   t	   rectpropst   propsR   R   R   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRu     s0    				c         C` s   |  j  S(   sg   
        Return the bbox Patch object. Returns None if the
        FancyBboxPatch is not made.
        (   Rd   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_bbox_patch  s    c         C` s  |  j  r|  j   } t |  j |  j   } t |  j |  j   } | j | | f  \ } } t |  |  \ } } } } |  j  j	 d d | |  t
 j |  j    }	 t   j |	  }
 |
 j | | | |  }
 |  j  j |
  | j |  j    } |  j  j |  n  d S(   s   
        Update the location and the size of the bbox. This method
        should be used when the position and size of the bbox needs to
        be updated before actually drawing the bbox.
        g        N(   Rd   R   R$   t   convert_xunitsRR   t   convert_yunitsRS   R3   RP   t
   set_boundsR/   R0   R.   R   R1   t	   translatet   set_transformt   points_to_pixelsR   t   set_mutation_scale(   RV   R8   t   transt   posxt   posyRN   RO   RL   RM   R;   R<   t   fontsize_in_pixel(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   update_bbox_position_size  s    	c         C` s   t  |  |  \ } } } } |  j j d d | |  t j |  j    } t   j |  }	 |	 j | | | |  }	 |  j j	 |	  | j
 |  j    }
 |  j j |
  |  j j |  d S(   sY    Update the location and the size of the bbox
        (FancyBboxPatch), and draw
        g        N(   RP   Rd   R   R/   R0   R.   R   R1   R   R   R   R   R   t   draw(   RV   R8   R   R   RN   RO   RL   RM   R;   R<   R   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt
   _draw_bbox  s    c         C` sF   t  d |  j d |  j d |  j  } |  j rB |  j j |  } n  d  S(   Nt   clip_boxt	   clip_patht   clip_on(   t   dictt   clipboxt	   _clippatht   _cliponRd   R   (   RV   t	   clippropsRq   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s
    		c         C` s$   t  t |   j |  |  j   d S(   s   
        Set the artist's clip :class:`~matplotlib.transforms.Bbox`.

        ACCEPTS: a :class:`matplotlib.transforms.Bbox` instance
        N(   Rt   RQ   t   set_clip_boxR   (   RV   R   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    c         C` s'   t  t |   j | |  |  j   d S(   s  
        Set the artist's clip path, which may be:

          * a :class:`~matplotlib.patches.Patch` (or subclass) instance

          * a :class:`~matplotlib.path.Path` instance, in which case
             an optional :class:`~matplotlib.transforms.Transform`
             instance may be provided, which will be applied to the
             path before using it for clipping.

          * *None*, to remove the clipping path

        For efficiency, if the path happens to be an axis-aligned
        rectangle, this method will set the clipping box to the
        corresponding rectangle and set the clipping path to *None*.

        ACCEPTS: [ (:class:`~matplotlib.path.Path`,
        :class:`~matplotlib.transforms.Transform`) |
        :class:`~matplotlib.patches.Patch` | None ]
        N(   Rt   RQ   t   set_clip_pathR   (   RV   t   pathR   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    c         C` s$   t  t |   j |  |  j   d S(   s   
        Set whether artist uses clipping.

        When False, artists will be visible outside of the axes, which can lead
        to unexpected results.

        Parameters
        ----------
        b : bool
            .. ACCEPTS: bool
        N(   Rt   RQ   t   set_clip_onR   (   RV   R   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   5  s    c         C` s   |  j  S(   s(   Returns the wrapping state for the text.(   t   _wrap(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   D  s    c         C` s   | |  _  d S(   s   Sets the wrapping state for the text.

        Parameters
        ----------
        wrap : bool
            .. ACCEPTS: bool
        N(   R   (   RV   Rp   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR^   H  s    c   	      C` s   |  j    j |  j    \ } } |  j   j   } |  j   } |  j d  |  j   } |  j | | | |  } |  j d | d | | |  } | d k r | } n( | d k r | } n d t	 | |  } | S(   sl   
        Returns the maximum line width for wrapping text based on the
        current orientation.
        R   i   ih  RZ   R   i   (
   R   R   t   get_positiont
   get_figureR}   t   get_horizontalalignmentRg   R.   t   _get_dist_to_boxR5   (	   RV   t   x0t   y0t
   figure_boxt	   alignmentR+   RZ   R   t
   line_width(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_wrap_line_widthR  s"    !			c         C` sd  | d k r\ | d } | t  j t  j |   } | j | t  j t  j d |   } n | d k r | d } | t  j t  j |   } | t  j t  j d |   } n | d k r| d } | j | t  j t  j |   } | t  j t  j d |   } nJ | j | t  j t  j |   } | j | t  j t  j d |   } t | |  S(   ss   
        Returns the distance from the given points, to the boundaries
        of a rotated box in pixels.
        i  iZ   i   (   t   matht   cost   radianst   x1t   y1R5   (   RV   R+   R   R   R   t   quadt   h1t   h2(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   o  s    
*
#
###'c         C` s4   |  j  j | |  j   t  \ } } } t j |  S(   sF   
        Returns the width of a given text string, in pixels.
        (   Re   R   t   get_fontpropertiesR|   R   t   ceil(   RV   R7   RD   RE   R?   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_rendered_text_width  s
    		c         C` s   |  j    r |  j   S|  j   } d } d } x |  j   j d  D] } | j d  } x t t |   D]{ } |  j | d | |  } | | k s | d k r | | d 7} d } n  | d k r | | } ql | d | | 7} ql WqD W| | S(   s   
        Return a copy of the text with new lines added, so that
        the text is wrapped relative to the parent figure.
        RX   t    s   
i    (   R   R   R   R   t   rangeR   R
  (   RV   R   t   wrapped_strR   t   wordt	   sub_wordsR   t   current_width(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s"    
	c         C` s  | d k	 r | |  _ n  |  j   s( d S|  j   d k r> d S| j d |  j    t |   R} | j |  \ } } } | j   } t	 | j
 | j   } t	 | j | j   } | j | | f  \ } } t j |  s t j |  rt j d  d S| j   \ }	 }
 | j r4| j | | |  n  | j   } | j | j    | j | j    | j | j  | j |  | j   } x| D]\ } } } } t |  d k r| n d } | | } | | } | j    r|
 | } n  | j! | |  j"    \ } } | j#   rEd d l$ m% } | | j#   |  } n | } | j"   r| j& | | | | | j' | d | q| j( | | | | | j' | d	 | d | qWWd QX| j)   | j* d  t+ |  _, d S(
   sI   
        Draws the :class:`Text` object to the given *renderer*.
        NRX   R7   s%   posx and posy should be finite valuesi   i    (   t   PathEffectRenderert   mtextR   (-   R   Re   R{   R   t
   open_groupt   get_gidR!   R2   R   R$   R   RR   R   RS   R3   R/   t   isfinitet   _logt   warningt   get_canvas_width_heightRd   R   t   new_gct   set_foregroundt	   get_colort	   set_alphat	   get_alphat   set_urlt   _urlt   _set_gc_clipR.   R   t   flipyR   R   t   get_path_effectst   matplotlib.patheffectsR  t   draw_texRc   t	   draw_textt   restoret   close_groupR|   R   (   RV   R8   R   Rq   t   infoR   R   R   R   t   canvaswt   canvasht   gcR,   R   RA   RB   RC   R  R   R   R  t   textrenderer(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s`     	

	

c         C` s   |  j  S(   s   Return the color of the text(   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s   |  j  S(   s7   Return the :class:`~font_manager.FontProperties` object(   Rc   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s
   |  j    S(   s   alias for get_fontproperties(   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_font_properties  s    c         C` s   |  j  j   S(   s5   Return the list of font families used for font lookup(   Rc   t
   get_family(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR.    s    c         C` s
   |  j    S(   s   alias for get_family(   R.  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontfamily	  s    c         C` s   |  j  j   S(   s   Return the font name as string(   Rc   t   get_name(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR0    s    c         C` s   |  j  j   S(   s   Return the font style as string(   Rc   t	   get_style(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR1    s    c         C` s   |  j  j   S(   s   Return the font size as integer(   Rc   t   get_size_in_points(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    c         C` s   |  j  j   S(   s#   Return the font variant as a string(   Rc   t   get_variant(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR3    s    c         C` s
   |  j    S(   s   alias for get_variant(   R3  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontvariant  s    c         C` s   |  j  j   S(   s'   Get the font weight as string or number(   Rc   t
   get_weight(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR5  !  s    c         C` s
   |  j    S(   s   alias for get_name(   R0  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontname%  s    c         C` s
   |  j    S(   s   alias for get_style(   R1  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontstyle)  s    c         C` s
   |  j    S(   s   alias for get_size(   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontsize-  s    c         C` s
   |  j    S(   s   alias for get_weight(   R5  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontweight1  s    c         C` s   |  j  j   S(   s*   Get the font stretch as a string or number(   Rc   t   get_stretch(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR:  5  s    c         C` s
   |  j    S(   s   alias for get_stretch(   R:  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_fontstretch9  s    c         C` s
   |  j    S(   s!   alias for get_horizontalalignment(   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_ha=  s    c         C` s   |  j  S(   sq   
        Return the horizontal alignment as string.  Will be one of
        'left', 'center' or 'right'.
        (   R`   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   A  s    c         C` s:   t  |  j |  j   } t  |  j |  j   } | | f S(   s>   Return the unitless position of the text as a tuple (*x*, *y*)(   R$   R   RR   R   RS   (   RV   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   H  s    c         C` s   |  j  |  j f S(   s5   Return the position of the text as a tuple (*x*, *y*)(   RR   RS   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   P  s    c         C` sy   |  j    \ } } | p |  j } | | |  j   |  j |  j |  j t |  j  |  j |  j	 |  j
 j t j |  |  j f S(   s   
        Return a hashable tuple of properties.

        Not intended to be human readable, but useful for backends who
        want to cache derived information about text (e.g., layouts) and
        need to know if the text has changed.
        (   R   Re   R   R   R_   R`   t   hashRc   Rb   R   t   figuret   dpit   weakreft   refRf   (   RV   R8   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   V  s    c         C` s   |  j  S(   s   Get the text as string(   RU   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   h  s    c         C` s
   |  j    S(   s&   alias for :meth:`getverticalalignment`(   t   get_verticalalignment(   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_val  s    c         C` s   |  j  S(   s{   
        Return the vertical alignment as string.  Will be one of
        'top', 'center', 'bottom' or 'baseline'.
        (   R_   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRB  p  s    c         C` s,  |  j    s t j   S| d k	 r= |  j j } | |  j _ n  |  j   d k rw |  j   \ } } t j | | d d  S| d k	 r | |  _	 n  |  j	 d k r t
 d   n  |  j |  j	  \ } } } |  j   \ }	 }
 |  j   j |	 |
 f  \ }	 }
 | j |	 |
  } | d k	 r(| |  j _ n  | S(   so  
        Return a :class:`~matplotlib.transforms.Bbox` object bounding
        the text, in display units.

        In addition to being used internally, this is useful for
        specifying clickable regions in a png file on a web page.

        *renderer* defaults to the _renderer attribute of the text
        object.  This is not assigned until the first execution of
        :meth:`draw`, so you must use this kwarg if you want
        to call :meth:`get_window_extent` prior to the first
        :meth:`draw`.  For getting web page regions, it is
        simpler to call the method after saving the figure.

        *dpi* defaults to self.figure.dpi; the renderer dpi is
        irrelevant.  For the web application, if figure.dpi is not
        the value used when saving the figure, then the value that
        was used must be specified as the *dpi* argument.
        RX   i    s%   Cannot get window extent w/o rendererN(   R{   R   t   unitR   R>  R?  R   R   R   Re   t   RuntimeErrorR2   R   R   R3   t
   translated(   RV   R8   R?  t   dpi_origt   txt   tyRq   R(  R   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR}   w  s&    
!c         C` s^   |  j  d k r. |  j t d | d |   n |  j  j t d |   |  j   t |  _ d S(   s   
        Set the background color of the text by updating the bbox.

        .. seealso::

            :meth:`set_bbox`
               To change the position of the bounding box.

        ACCEPTS: any matplotlib color
        t	   facecolort	   edgecolorN(   Rd   R   Ru   R   R   R   R   R   (   RV   Rh   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_backgroundcolor  s
    
c         C` sD   y t  |  Wn t k
 r- t |  } n X| |  _ t |  _ d S(   s]   
        Set the foreground color of the text

        ACCEPTS: any matplotlib color
        N(   R=  R&   t   tupleR   R   R   (   RV   Rh   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR\     s    	c         C` s   |  j  |  d S(   s!   alias for set_horizontalalignmentN(   t   set_horizontalalignment(   RV   t   align(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_ha  s    c         C` sA   d } | | k r+ t  d t |    n  | |  _ t |  _ d S(   sj   
        Set the horizontal alignment to one of

        ACCEPTS: [ 'center' | 'right' | 'left' ]
        R   R   RZ   s&   Horizontal alignment must be one of %sN(   R   R   RZ   (   R%   t   strR`   R   R   (   RV   RO  t   legal(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRN    s    	c         C` s   |  j  |  d S(   s   alias for set_multialignmentN(   t   set_multialignment(   RV   RO  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_ma  s    c         C` sA   d } | | k r+ t  d t |    n  | |  _ t |  _ d S(   s1  
        Set the alignment for multiple lines layout.  The layout of the
        bounding box of all the lines is determined bu the horizontalalignment
        and verticalalignment properties, but the multiline text within that
        box can be

        ACCEPTS: ['left' | 'right' | 'center' ]
        R   R   RZ   s&   Horizontal alignment must be one of %sN(   R   R   RZ   (   R%   RQ  Ra   R   R   (   RV   RO  RR  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRS    s    		c         C` s   | |  _  t |  _ d S(   s   
        Set the line spacing as a multiple of the font size.
        Default is 1.2.

        ACCEPTS: float (multiple of font size)
        N(   Rf   R   R   (   RV   t   spacing(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_linespacing  s    	c         C` s   |  j  j |  t |  _ d S(   s  
        Set the font family.  May be either a single string, or a list
        of strings in decreasing priority.  Each string may be either
        a real font name or a generic font class name.  If the latter,
        the specific font names will be looked up in the
        :file:`matplotlibrc` file.

        ACCEPTS: [FONTNAME | 'serif' | 'sans-serif' | 'cursive' | 'fantasy' |
                  'monospace' ]
        N(   Rc   t
   set_familyR   R   (   RV   t   fontname(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRW    s    c         C` s   |  j  j |  t |  _ d S(   sv   
        Set the font variant, either 'normal' or 'small-caps'.

        ACCEPTS: [ 'normal' | 'small-caps' ]
        N(   Rc   t   set_variantR   R   (   RV   t   variant(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRY     s    c         C` s   |  j  |  S(   s   alias for set_variant(   RY  (   RV   RZ  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontvariant	  s    c         C` s   |  j  |  S(   s   alias for set_family(   RW  (   RV   RX  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_name  s    c         C` s   |  j  |  d S(   s   alias for set_familyN(   RW  (   RV   RX  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontname  s    c         C` s   |  j  j |  t |  _ d S(   sZ   
        Set the font style.

        ACCEPTS: [ 'normal' | 'italic' | 'oblique']
        N(   Rc   t	   set_styleR   R   (   RV   t	   fontstyle(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR^    s    c         C` s   |  j  |  S(   s   alias for set_style(   R^  (   RV   R_  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontstyle  s    c         C` s   |  j  j |  t |  _ d S(   s  
        Set the font size.  May be either a size string, relative to
        the default font size, or an absolute font size in points.

        ACCEPTS: [size in points | 'xx-small' | 'x-small' | 'small' |
                  'medium' | 'large' | 'x-large' | 'xx-large' ]
        N(   Rc   t   set_sizeR   R   (   RV   t   fontsize(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRa  "  s    c         C` s   |  j  |  S(   s   alias for set_size(   Ra  (   RV   Rb  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontsize-  s    c         C` s   |  j  j |  t |  _ d S(   s.  
        Set the font weight.

        ACCEPTS: [a numeric value in range 0-1000 | 'ultralight' | 'light' |
                  'normal' | 'regular' | 'book' | 'medium' | 'roman' |
                  'semibold' | 'demibold' | 'demi' | 'bold' | 'heavy' |
                  'extra bold' | 'black' ]
        N(   Rc   t
   set_weightR   R   (   RV   t   weight(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRd  1  s    	c         C` s   |  j  |  S(   s   alias for set_weight(   Rd  (   RV   Re  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontweight=  s    c         C` s   |  j  j |  t |  _ d S(   sR  
        Set the font stretch (horizontal condensation or expansion).

        ACCEPTS: [a numeric value in range 0-1000 | 'ultra-condensed' |
                  'extra-condensed' | 'condensed' | 'semi-condensed' |
                  'normal' | 'semi-expanded' | 'expanded' | 'extra-expanded' |
                  'ultra-expanded' ]
        N(   Rc   t   set_stretchR   R   (   RV   t   stretch(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRg  A  s    	c         C` s   |  j  |  S(   s   alias for set_stretch(   Rg  (   RV   Rh  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontstretchM  s    c         C` s&   |  j  | d  |  j | d  d S(   sQ   
        Set the (*x*, *y*) position of the text

        ACCEPTS: (x,y)
        i    i   N(   t   set_xt   set_y(   RV   t   xy(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_positionQ  s    c         C` s   | |  _  t |  _ d S(   sJ   
        Set the *x* position of the text

        ACCEPTS: float
        N(   RR   R   R   (   RV   RB   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRj  Z  s    	c         C` s   | |  _  t |  _ d S(   sJ   
        Set the *y* position of the text

        ACCEPTS: float
        N(   RS   R   R   (   RV   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRk  c  s    	c         C` s   | |  _  t |  _ d S(   sq   
        Set the rotation of the text

        ACCEPTS: [ angle in degrees | 'vertical' | 'horizontal' ]
        N(   Rb   R   R   (   RV   t   s(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_rotationl  s    	c         C` s   |  j  |  d S(   s   alias for set_verticalalignmentN(   t   set_verticalalignment(   RV   RO  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_vau  s    c         C` sA   d } | | k r+ t  d t |    n  | |  _ t |  _ d S(   sk   
        Set the vertical alignment

        ACCEPTS: [ 'center' | 'top' | 'bottom' | 'baseline' ]
        R   t   bottomR   RY   s$   Vertical alignment must be one of %sN(   R   Rr  R   RY   (   R%   RQ  R_   R   R   (   RV   RO  RR  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRp  y  s    	c         C` s   d | f |  _  t |  _ d S(   s   
        Set the text string *s*

        It may contain newlines (``\n``) or math in LaTeX syntax.

        ACCEPTS: string or anything printable with '%s' conversion.
        s   %sN(   RU   R   R   (   RV   Rn  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    c         C` sq   | d k r t d } n  | r> |  d k r4 d }  n  |  d f St j |   rW |  t f S|  j d d  t f Sd S(   sS  
        Returns a cleaned string and a boolean flag.
        The flag indicates if the given string *s* contains any mathtext,
        determined by counting unescaped dollar signs. If no mathtext
        is present, the cleaned string has its dollar signs unescaped.
        If usetex is on, the flag always has the value "TeX".
        s   text.usetexR  s   \ t   TeXs   \$t   $N(   R   R   R   R   R   t   replaceR|   (   Rn  Ro   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    	

c         C` s=   t  | t j  r! t |  } n  | j   |  _ t |  _ d S(   s   
        Set the font properties that control the text.  *fp* must be a
        :class:`matplotlib.font_manager.FontProperties` object.

        ACCEPTS: a :class:`matplotlib.font_manager.FontProperties` instance
        N(   R'   R(   R)   R	   R   Rc   R   R   (   RV   t   fp(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_fontproperties  s    c         C` s   |  j  |  d S(   s   alias for set_fontpropertiesN(   Rw  (   RV   Rv  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_font_properties  s    c         C` s8   | d k r t d |  _ n t |  |  _ t |  _ d S(   s   
        Parameters
        ----------
        usetex : bool or None
            Whether to render using TeX, ``None`` means to use
            :rc:`text.usetex`.

            .. ACCEPTS: bool or None
        s   text.usetexN(   R   R   t   _usetext   boolR   R   (   RV   Ro   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR]     s    
c         C` s"   |  j  d k r t d S|  j  Sd S(   s   
        Return whether this `Text` object uses TeX for rendering.

        If the user has not manually set this value, it defaults to
        :rc:`text.usetex`.
        s   text.usetexN(   Ry  R   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    N(a   t   __name__t
   __module__t   __doc__t   zorderR   t   maxdictR   RW   R   R|   R[   R   Rw   R   R   R   R.   Rg   R   R   R2   Ru   R   R   R   R   R   R   R   R   R^   R   R   R
  R   R   t   allow_rasterizationR   R  R  R-  R.  R/  R0  R1  R   R3  R4  R5  R6  R7  R8  R9  R:  R;  R<  R   R   R   R   R   RC  RB  R}   RL  R\   RP  RN  RT  RS  RV  RW  RY  R[  R\  R]  R^  R`  Ra  Rc  Rd  Rf  Rg  Ri  Rm  Rj  Rk  Ro  Rq  Rp  R   t   staticmethodR   Rw  Rx  R]   R   (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRQ   w   s   		&											-									
			
	#F																								+							
																													t   TextWithDashc           B` s  e  Z d  Z d Z  d   Z d d d d d d d d d d d d d d d d  Z d	   Z d
   Z d d  Z d   Z	 d   Z
 d 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   Z RS(    sb  
    This is basically a :class:`~matplotlib.text.Text` with a dash
    (drawn with a :class:`~matplotlib.lines.Line2D`) before/after
    it. It is intended to be a drop-in replacement for
    :class:`~matplotlib.text.Text`, and should behave identically to
    it when *dashlength* = 0.0.

    The dash always comes between the point specified by
    :meth:`~matplotlib.text.Text.set_position` and the text. When a
    dash exists, the text alignment arguments (*horizontalalignment*,
    *verticalalignment*) are ignored.

    *dashlength* is the length of the dash in canvas units.
    (default = 0.0).

    *dashdirection* is one of 0 or 1, where 0 draws the dash after the
    text and 1 before.  (default = 0).

    *dashrotation* specifies the rotation of the dash, and should
    generally stay *None*. In this case
    :meth:`~matplotlib.text.TextWithDash.get_dashrotation` returns
    :meth:`~matplotlib.text.Text.get_rotation`.  (i.e., the dash takes
    its rotation from the text's rotation). Because the text center is
    projected onto the dash, major deviations in the rotation cause
    what may be considered visually unappealing results.
    (default = *None*)

    *dashpad* is a padding length to add (or subtract) space
    between the text and the dash, in canvas units.
    (default = 3)

    *dashpush* "pushes" the dash and text away from the point
    specified by :meth:`~matplotlib.text.Text.set_position` by the
    amount in canvas units.  (default = 0)

    .. note::

        The alignment of the two objects is based on the bounding box
        of the :class:`~matplotlib.text.Text`, as obtained by
        :meth:`~matplotlib.artist.Artist.get_window_extent`.  This, in
        turn, appears to depend on the font metrics as given by the
        rendering backend. Hence the quality of the "centering" of the
        label text with respect to the dash varies depending on the
        backend used.

    .. note::

        I'm not sure that I got the
        :meth:`~matplotlib.text.TextWithDash.get_window_extent` right,
        or whether that's sufficient for providing the object bounding
        box.

    t   textwithdashc         C` s    d |  j  |  j t |  j  f S(   Ns   TextWithDash(%g,%g,%s)(   RR   RS   RT   RU   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   __str__  s    i    RX   R   g        i   c         C` s   t  j |  d | d | d | d | d | d | d | d | d	 |	 d
 |
 
t d | | f d | | f d d d d  |  _ t |  |  _ t |  |  _ | |  _ | |  _ | |  _	 | |  _
 | |  _ d  S(   NRB   RC   R7   Rh   Ri   Rj   Rk   Rl   R+   Rm   t   xdatat   ydatat   kt	   linestylet   -(   RQ   R[   R
   t   dashlineR$   t   _dashxt   _dashyt   _dashlengtht   _dashdirectiont   _dashrotationt   _dashpadt	   _dashpush(   RV   RB   RC   R7   Rh   Ri   Rj   Rk   Rl   R+   Rm   t
   dashlengtht   dashdirectiont   dashrotationt   dashpadt   dashpush(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR[     s$    $				c         C` s:   t  |  j |  j   } t  |  j |  j   } | | f S(   s>   Return the unitless position of the text as a tuple (*x*, *y*)(   R$   R   R  R   R  (   RV   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   ?  s    c         C` s   |  j  |  j f S(   s5   Return the position of the text as a tuple (*x*, *y*)(   R  R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   G  s    c         C` si   g  t  j |  d | D] } | ^ q } | j |  j |  j |  j |  j |  j |  j |  j	 g  t
 |  S(   s   
        Return a hashable tuple of properties.

        Not intended to be human readable, but useful for backends who
        want to cache derived information about text (e.g., layouts) and
        need to know if the text has changed.
        R8   (   RQ   R   R4   RR   RS   R  R  R  R  R  RM  (   RV   R8   t   pR   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   M  s
    (c         C` sO   |  j  |  t j |  |  |  j   d k rB |  j j |  n  t |  _ d S(   sP   
        Draw the :class:`TextWithDash` object to the given *renderer*.
        g        N(   t   update_coordsRQ   R   t   get_dashlengthR  R|   R   (   RV   R8   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   [  s
    c   !      C` s  |  j    \ } } |  j   } | d k rA | | |  _ |  _ d S|  j   } |  j   } |  j   } |  j   } t |  }	 t	 j
 |	 d | d }
 t	 j |
  t	 j |
  } } |  j   } | j | | f  } t	 j | | g  } | | | } | | | | } | j   } | j t |   \ } } | j t |   \ } } |  j j | | f | | f  t j |  d | } | j | j } } | d k r| } d } na | d k rd } | } nF | | } | } | | } | | k s| | k  r| } | | } n  t	 j | | g  d } | d | t	 j t	 j | |   9} | | d d | } | j t |   \ } }  | |  |  _ |  _ t j |  d | } | j   |  _ |  j j t	 j | g  t  t j |  d  t j |  d  d S(   s   
        Computes the actual *x*, *y* coordinates for text based on the
        input *x*, *y* and the *dashlength*. Since the rotation is
        with respect to the actual canvas's coordinates we need to map
        back and forth.
        g        Ng     f@i   R8   i   R   (    R   R  RR   RS   t   get_dashrotationt   get_dashdirectiont   get_dashpadt   get_dashpushR.   R/   t   piR  t   sinR   R3   R   t   invertedRM  R  t   set_dataRQ   R}   R   R   t   sqrtt   dott   frozent   _twd_window_extentt   update_from_data_xyR|   RN  Rp  (!   RV   R8   t   dashxt   dashyR  R  R  R  R  R,   R;   t	   cos_thetat	   sin_thetaR   t   cxyt   cdt   c1t   c2t   inverseR  R  t   x2t   y2t   weRD   RE   t   dxt   dyt	   tan_thetat   cwdt   cwt   newxt   newy(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  e  sZ    		

'c         C` s=   |  j  |  |  j   d k r2 t j |  d | S|  j Sd S(   so  
        Return a :class:`~matplotlib.transforms.Bbox` object bounding
        the text, in display units.

        In addition to being used internally, this is useful for
        specifying clickable regions in a png file on a web page.

        *renderer* defaults to the _renderer attribute of the text
        object.  This is not assigned until the first execution of
        :meth:`draw`, so you must use this kwarg if you want
        to call :meth:`get_window_extent` prior to the first
        :meth:`draw`.  For getting web page regions, it is
        simpler to call the method after saving the figure.
        g        R8   N(   R  R  RQ   R}   R  (   RV   R8   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR}     s    c         C` s   |  j  S(   s-   
        Get the length of the dash.
        (   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s   | |  _  t |  _ d S(   sT   
        Set the length of the dash.

        ACCEPTS: float (canvas units)
        N(   R  R   R   (   RV   t   dl(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_dashlength  s    	c         C` s   |  j  S(   sO   
        Get the direction dash.  1 is before the text and 0 is after.
        (   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s   | |  _  t |  _ d S(   s  
        Set the direction of the dash following the text.
        1 is before the text and 0 is after. The default
        is 0, which is what you'd want for the typical
        case of ticks below and on the left of the figure.

        ACCEPTS: int (1 is before, 0 is after)
        N(   R  R   R   (   RV   t   dd(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_dashdirection  s    		c         C` s$   |  j  d k r |  j   S|  j  Sd S(   s:   
        Get the rotation of the dash in degrees.
        N(   R  R   R.   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    
c         C` s   | |  _  t |  _ d S(   s\   
        Set the rotation of the dash, in degrees

        ACCEPTS: float (degrees)
        N(   R  R   R   (   RV   t   dr(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_dashrotation  s    	c         C` s   |  j  S(   sW   
        Get the extra spacing between the dash and the text, in canvas units.
        (   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s   | |  _  t |  _ d S(   s   
        Set the "pad" of the TextWithDash, which is the extra spacing
        between the dash and the text, in canvas units.

        ACCEPTS: float (canvas units)
        N(   R  R   R   (   RV   t   dp(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_dashpad  s    	c         C` s   |  j  S(   sr   
        Get the extra spacing between the dash and the specified text
        position, in canvas units.
        (   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    c         C` s   | |  _  t |  _ d S(   s   
        Set the "push" of the TextWithDash, which
        is the extra spacing between the beginning
        of the dash and the specified position.

        ACCEPTS: float (canvas units)
        N(   R  R   R   (   RV   R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   set_dashpush  s    	c         C` s&   |  j  | d  |  j | d  d S(   sd   
        Set the (*x*, *y*) position of the :class:`TextWithDash`.

        ACCEPTS: (x, y)
        i    i   N(   Rj  Rk  (   RV   Rl  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRm  #  s    c         C` s   t  |  |  _ t |  _ d S(   s\   
        Set the *x* position of the :class:`TextWithDash`.

        ACCEPTS: float
        N(   R$   R  R   R   (   RV   RB   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRj  ,  s    c         C` s   t  |  |  _ t |  _ d S(   s\   
        Set the *y* position of the :class:`TextWithDash`.

        ACCEPTS: float
        N(   R$   R  R   R   (   RV   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyRk  5  s    c         C` s-   t  j |  |  |  j j |  t |  _ d S(   s   
        Set the :class:`matplotlib.transforms.Transform` instance used
        by this artist.

        ACCEPTS: a :class:`matplotlib.transforms.Transform` instance
        N(   RQ   R   R  R   R   (   RV   R@   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   >  s    c         C` s   |  j  S(   s0   return the figure instance the artist belongs to(   R>  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   I  s    c         C` s$   t  j |  |  |  j j |  d S(   s~   
        Set the figure instance the artist belong to.

        ACCEPTS: a :class:`matplotlib.figure.Figure` instance
        N(   RQ   t
   set_figureR  (   RV   t   fig(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  M  s    N(   R{  R|  R}  R  R   R[   R   R   R   R   R  R}   R  R  R  R  R  R  R  R  R  R  Rm  Rj  Rk  R   R   R  (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    sL   5					
	T											
										t
   OffsetFromc           B` s>   e  Z d  Z d d  Z d   Z d   Z d   Z d   Z RS(   s3   Callable helper class for working with `Annotation`t   pointsc         C` s#   | |  _  | |  _ |  j |  d S(   sY  
        Parameters
        ----------
        artist : `Artist`, `BboxBase`, or `Transform`
            The object to compute the offset from.

        ref_coord : length 2 sequence
            If `artist` is an `Artist` or `BboxBase`, this values is
            the location to of the offset origin in fractions of the
            `artist` bounding box.

            If `artist` is a transform, the offset origin is the
            transform applied to this value.

        unit : {'points, 'pixels'}
            The screen units to use (pixels or points) for the offset
            input.

        N(   t   _artistt
   _ref_coordt   set_unit(   RV   R   t	   ref_coordRD  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR[   [  s    		c         C` s(   | d k r t  d   n  | |  _ d S(   s   
        The unit for input to the transform used by ``__call__``

        Parameters
        ----------
        unit : {'points', 'pixels'}
        R  t   pixelss-   'unit' must be one of [ 'points' | 'pixels' ]N(   R  R  (   R%   t   _unit(   RV   RD  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  s  s    c         C` s   |  j  S(   s8   The unit for input to the transform used by ``__call__``(   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_unit  s    c         C` s-   |  j    } | d k r d S| j d  Sd  S(   NR  g      ?(   R  R   (   RV   R8   RD  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt
   _get_scale  s    c         C` s1  t  |  j t  rh |  j j |  } | j \ } } } } |  j \ } } | | | | | | }	 }
 n t  |  j t  r |  j j \ } } } } |  j \ } } | | | | | | }	 }
 n< t  |  j t  r |  j j |  j  \ }	 }
 n t	 d   |  j
 |  } t   j | |  j |	 |
  } | S(   sX  
        Return the offset transform.

        Parameters
        ----------
        renderer : `RendererBase`
            The renderer to use to compute the offset

        Returns
        -------
        transform : `Transform`
            Maps (x, y) in pixel or point units to screen units
            relative to the given artist.
        s   unknown type(   R'   R  R   R}   R~   R  R   R   R3   RE  R  R   t   scaleR   (   RV   R8   Rq   R   R   RD   RE   t   xft   yfRB   RC   t   scR<   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   __call__  s      !(   R{  R|  R}  R[   R  R  R  R  (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  Y  s   			t   _AnnotationBasec           B` se   e  Z d  d
 d  Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d
 e d	  Z RS(   t   datac         C` s,   | |  _  | |  _ |  j |  d  |  _ d  S(   N(   Rl  t   xycoordst   set_annotation_clipR   t
   _draggable(   RV   Rl  R  t   annotation_clip(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR[     s    		c   
      C` s   t  | t  r | \ } } n | | } } | d k rO t |  j |   } n  | d k rs t |  j |   } n  |  j | |  } | j | | f  \ } }	 | |	 f S(   NR  (   R'   RM  R$   R   R   t   _get_xy_transformR3   (
   RV   R8   RB   RC   Rn  t   s1t   s2R<   R  R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_xy  s    c         C` se  t  | t  rb | \ } } d d l m } |  j | |  } |  j | |  } | | |  } | St |  r | |  } t  | t  r t |  St  | t  r | St	 d   n| t  | t
  r | j |  }	 t |	  St  | t  r t |  St  | t  r	| St  | t j  s1t	 d | f   n  | d k rG|  j j S| d k rd d l m }
 |
 j   } | |  j j } | S| j   } t |  d k rt d	 |   n  d \ } } | \ } } | d
 k r|  j j } n | d k r|  j j } n  | d  k	 r| j d  } n | d k r<|  j |  } n  | d  k	 rQ| \ } } d d l m } | d k r|  j j   d } |   j | |  } n | d k r|   } n | d k r|  j   } | |  j j   d } |   j | |  } nG | d k r1| j d \ } } |   j | |  } n t d	 |   | j | |  St d	 |   d  S(   Ni    (   t   blended_transform_factorys   unknown return type ...s   unknown coordinate type : %sR  t   polar(   t	   PolarAxesi   s!   %s is not a recognized coordinateR>  t   axest   offset(   R   R  g      R@R  Rb  t   fraction(   NN(    R'   RM  t   matplotlib.transformsR  R  Ry   R   R   R   RE  R   R}   R(   R)   R  t	   transDatat   matplotlib.projectionsR  t   PolarTransformR   R   R%   R   R>  Rq   R~   t   _get_ref_xyR   t   get_dpiR  R   R   (   RV   R8   Rn  R  R  R  t   tr1t   tr2R<   Rq   R  R   t   s_t   bbox0t   xy0t	   bbox_nameRD  t   ref_xt   ref_yR   t   dppRb  RD   RE   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    sz    



c   
      C` s>  t  |  j t  r |  j \ } } t  | t j  rI | j   d d k sq t  | t j  r | j   d d k r t d   n  |  j \ } } |  j | | | |  \ } } |  j | | | |  \ } }	 | |	 f St  |  j t j  r|  j j   d d k rt d   n( |  j \ } } |  j | | | |  j  Sd S(   sy   
        return x, y (in display coordinate) that is to be used for a reference
        of any offset coordinate
        i    R  s+   xycoords should not be an offset coordinateN(	   R'   R  RM  R(   R)   R   R%   Rl  R  (
   RV   R8   R  R  RB   RC   R  R  R  R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s     
c         C` s   | |  _  d S(   sK  
        set *annotation_clip* attribute.

          * True: the annotation will only be drawn when self.xy is inside
                  the axes.
          * False: the annotation will always be drawn regardless of its
                   position.
          * None: the self.xy will be checked only if *xycoords* is "data"
        N(   t   _annotation_clip(   RV   R   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  >  s    
c         C` s   |  j  S(   s   
        Return *annotation_clip* attribute.
        See :meth:`set_annotation_clip` for the meaning of return values.
        (   R  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   get_annotation_clipJ  s    c         C` s(   |  j  \ } } |  j | | | |  j  S(   s1   Return the pixel position of the annotated point.(   Rl  R  R  (   RV   R8   RB   RC   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   _get_position_xyQ  s    c         C` sJ   |  j    } | s- | d k rF |  j d k rF |  j j |  sF t Sn  t S(   sb   
        given the xy pixel coordinate, check if the annotation need to
        be drawn.
        R  N(   R  R   R  R  t   contains_pointR|   R   (   RV   R8   t   xy_pixelR   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt	   _check_xyV  s
    !c         C` s   d d l  m } |  j d k	 } | d k r5 | } n  | rb |  j d k r | |  |  |  _ q n( |  j d k	 r |  j j   n  d |  _ |  j S(   sc  
        Set the draggable state -- if state is

          * None : toggle the current state

          * True : turn draggable on

          * False : turn draggable off

        If draggable is on, you can drag the annotation on the canvas with
        the mouse.  The DraggableAnnotation helper instance is returned if
        draggable is on.
        i    (   t   DraggableAnnotationN(   t   matplotlib.offsetboxR  R  R   t
   disconnect(   RV   t   statet   use_blitR  t   is_draggable(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt	   draggablee  s    
	N(   R{  R|  R   R[   R  R  R  R  R  R  R  R|   R  (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s   		S	#				t
   Annotationc           B` s   e  Z d    Z e j d d d d d d   Z d   Z e d    Z	 e	 j
 d    Z	 e d    Z e j
 d    Z d   Z d	   Z d
   Z e j d    Z d d  Z RS(   c         C` s(   d |  j  d |  j  d t |  j  f S(   Ns   Annotation(%g,%g,%s)i    i   (   Rl  RT   RU   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR    s    
R  c         K` sl  t  j |  | d | d | | d k rP | d k	 rP | | k rP t j d  n  | d k rh |  j } n  | |  _ | d k r |  j } n  | \ }	 }
 t j |  |	 |
 | |  | |  _	 d |  _
 | d k	 r_d | k r |  j	 j   } | j d d  |  _ nH d } t   } x6 |  j	 j   D]% \ } } | | k r| | | <qqWt d d |  |  _ n	 d |  _ d S(   s  
        Annotate the point ``xy`` with text ``s``.

        Additional kwargs are passed to `~matplotlib.text.Text`.

        Parameters
        ----------

        s : str
            The text of the annotation

        xy : iterable
            Length 2 sequence specifying the *(x,y)* point to annotate

        xytext : iterable, optional
            Length 2 sequence specifying the *(x,y)* to place the text
            at.  If None, defaults to ``xy``.

        xycoords : str, Artist, Transform, callable or tuple, optional

            The coordinate system that ``xy`` is given in.

            For a `str` the allowed values are:

            =================   ===============================================
            Property            Description
            =================   ===============================================
            'figure points'     points from the lower left of the figure
            'figure pixels'     pixels from the lower left of the figure
            'figure fraction'   fraction of figure from lower left
            'axes points'       points from lower left corner of axes
            'axes pixels'       pixels from lower left corner of axes
            'axes fraction'     fraction of axes from lower left
            'data'              use the coordinate system of the object being
                                annotated (default)
            'polar'             *(theta,r)* if not native 'data' coordinates
            =================   ===============================================

            If a `~matplotlib.artist.Artist` object is passed in the units are
            fraction if it's bounding box.

            If a `~matplotlib.transforms.Transform` object is passed
            in use that to transform ``xy`` to screen coordinates

            If a callable it must take a
            `~matplotlib.backend_bases.RendererBase` object as input
            and return a `~matplotlib.transforms.Transform` or
            `~matplotlib.transforms.Bbox` object

            If a `tuple` must be length 2 tuple of str, `Artist`,
            `Transform` or callable objects.  The first transform is
            used for the *x* coordinate and the second for *y*.

            See :ref:`plotting-guide-annotation` for more details.

            Defaults to ``'data'``

        textcoords : str, `Artist`, `Transform`, callable or tuple, optional
            The coordinate system that ``xytext`` is given, which
            may be different than the coordinate system used for
            ``xy``.

            All ``xycoords`` values are valid as well as the following
            strings:

            =================   =========================================
            Property            Description
            =================   =========================================
            'offset points'     offset (in points) from the *xy* value
            'offset pixels'     offset (in pixels) from the *xy* value
            =================   =========================================

            defaults to the input of ``xycoords``

        arrowprops : dict, optional
            If not None, properties used to draw a
            `~matplotlib.patches.FancyArrowPatch` arrow between ``xy`` and
            ``xytext``.

            If `arrowprops` does not contain the key ``'arrowstyle'`` the
            allowed keys are:

            ==========   ======================================================
            Key          Description
            ==========   ======================================================
            width        the width of the arrow in points
            headwidth    the width of the base of the arrow head in points
            headlength   the length of the arrow head in points
            shrink       fraction of total length to 'shrink' from both ends
            ?            any key to :class:`matplotlib.patches.FancyArrowPatch`
            ==========   ======================================================

            If the `arrowprops` contains the key ``'arrowstyle'`` the
            above keys are forbidden.  The allowed values of
            ``'arrowstyle'`` are:

            ============   =============================================
            Name           Attrs
            ============   =============================================
            ``'-'``        None
            ``'->'``       head_length=0.4,head_width=0.2
            ``'-['``       widthB=1.0,lengthB=0.2,angleB=None
            ``'|-|'``      widthA=1.0,widthB=1.0
            ``'-|>'``      head_length=0.4,head_width=0.2
            ``'<-'``       head_length=0.4,head_width=0.2
            ``'<->'``      head_length=0.4,head_width=0.2
            ``'<|-'``      head_length=0.4,head_width=0.2
            ``'<|-|>'``    head_length=0.4,head_width=0.2
            ``'fancy'``    head_length=0.4,head_width=0.4,tail_width=0.4
            ``'simple'``   head_length=0.5,head_width=0.5,tail_width=0.2
            ``'wedge'``    tail_width=0.3,shrink_factor=0.5
            ============   =============================================

            Valid keys for `~matplotlib.patches.FancyArrowPatch` are:

            ===============  ==================================================
            Key              Description
            ===============  ==================================================
            arrowstyle       the arrow style
            connectionstyle  the connection style
            relpos           default is (0.5, 0.5)
            patchA           default is bounding box of the text
            patchB           default is None
            shrinkA          default is 2 points
            shrinkB          default is 2 points
            mutation_scale   default is text size (in points)
            mutation_aspect  default is 1.
            ?                any key for :class:`matplotlib.patches.PathPatch`
            ===============  ==================================================

            Defaults to None

        annotation_clip : bool, optional
            Controls the visibility of the annotation when it goes
            outside the axes area.

            If `True`, the annotation will only be drawn when the
            ``xy`` is inside the axes. If `False`, the annotation will
            always be drawn regardless of its position.

            The default is `None`, which behave as `True` only if
            *xycoords* is "data".

        Returns
        -------
        Annotation

        R  R  sg   You have used the `textcoords` kwarg, but not the `xytext` kwarg.  This can lead to surprising results.t
   arrowstylet   relposg      ?R   t	   headwidtht
   headlengtht   shrinkt   fraci    i   N(   g      ?g      ?(   R   R  R  R  R  (   i    i    (   i   i   (   R  R[   R   t   warningst   warnR  t   _textcoordsRl  RQ   t
   arrowpropst   arrowR   Rs   t   _arrow_relposR   t   itemsR   t   arrow_patch(   RV   Rn  Rl  t   xytextR  t
   textcoordsR
  R  R   RB   RC   t	   shapekeysR   t   val(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR[     s<    				 		c         C` s   t  j |  |  \ } } |  j d  k	 rN |  j j |  \ } } | pH | } n  |  j d  k	 r |  j j |  \ } } | p~ | } n  | | f S(   N(   RQ   R   R  R   R  (   RV   t   eventR   t   tinfot   in_arrowR=   t   in_patch(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR   U  s    c         C` s
   |  j    S(   N(   R   (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   xyann`  s    c         C` s   |  j  |  d  S(   N(   Rm  (   RV   R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  d  s    c         C` s   |  j  S(   N(   R	  (   RV   (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt	   anncoordsh  s    c         C` s   | |  _  d  S(   N(   R	  (   RV   t   coords(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  l  s    c         C` sX   |  j  d  k	 r" |  j  j |  n  |  j d  k	 rD |  j j |  n  t j |  |  d  S(   N(   R  R   R  R  R   (   RV   R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR  p  s
    c         C` s#   |  j  |  } |  j | |  d S(   sQ   "Update the pixel positions of the annotated point and the
        text.
        N(   R  t   _update_position_xytext(   RV   R8   R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   update_positionsx  s    c   "      ` s  |  j  |  j | |  j   |  j   \ } } | \ } } |  j d k	 r| \    t j |  |  j \ } } }	 }
 | |	 } | |
 } d | | } d | | } |  j j	   } | j
 d |  j    } |  j j |  d | k r| j
 d d  } | j
 d d  } | j
 d d	  } | j
 d
 d  } | d k	 rMt j d  n  | j
 d d	  } t d | | d | | d | |  } |  j j d |  | d f | d f | d f f } | d f | d f | d f f } t   f d   | D  \ } \ } } t  f d   | D  \ } \ } } | | f |  _ t j |  |    } | | | j d  } | |  j _ | |  j _ n  |  j } t j |  |  }  |  j |  j | d } |  j |  j | d } |  j j | | f | | f  d | k r|  j j | j
 d   q|  j r7|  j j |  j  q| j d  }! |  j    d k rl|  j j d  d St j |  |  }  |  j \ } } }	 }
 | |! d 8} | |! d 8} |	 |! 7}	 |
 |! 7}
 t! d | | f d |	 d |
  } | j  t"    | j# t$  |  j j |  n  d S(   sW   Update the pixel positions of the annotation text and the arrow
        patch.
        g      ?t   mutation_scaleR  R  g        R   i   R  i   R  sh   'frac' option in 'arrowprops' is no longer supported; use 'headlength' to set the head length in points.R  t   head_lengtht
   head_widtht
   tail_widtht   simplei    i   c         3` s)   |  ] } t  | d     | f Vq d S(   i    N(   t   abs(   t   .0R  (   R   (    s.   lib/python2.7/site-packages/matplotlib/text.pys	   <genexpr>  s    c         3` s)   |  ] } t  | d     | f Vq d S(   i    N(   R!  (   R"  R  (   R   (    s.   lib/python2.7/site-packages/matplotlib/text.pys	   <genexpr>  s    t   patchARX   Ng       @Rl  R   (%   R   R  R  R   R
  R   RQ   R}   R~   R   Rs   R   R  R   R  R  R   t   set_arrowstyleR5   R  R/   t   hypotR   t   shrinkAt   shrinkBR   R   R   R   t   set_positionst
   set_patchARd   R   R   R   R   R|   ("   RV   R8   R  t   ox0t   oy0t   ox1t   oy1R   R   RD   RE   R   R@   t   xct   ycR?   t   msR  R   R  R  R  t   stylekwt   xpost   yposR=   RB   t   relposxRC   t   relposyt
   shrink_ptsR  Rq   R   (    (   R   R   s.   lib/python2.7/site-packages/matplotlib/text.pyR    sx    !



!!((		

	c         C` s   | d k	 r | |  _ n  |  j   s( d S|  j |  } |  j | |  sM d S|  j | |  |  j |  |  j d k	 r |  j j d k r |  j d k	 r |  j |  j _ n  |  j j	 |  n  t
 j	 |  |  d S(   sN   
        Draw the :class:`Annotation` object to the given *renderer*.
        N(   R   Re   R{   R  R  R  R   R  R>  R   RQ   (   RV   R8   R  (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s    !c         C` s   |  j    s t j   S|  j } |  j } t j |  d | } | g } |  j d k	 rq | j | j d |   n+ |  j d k	 r | j | j d |   n  t j	 |  S(   s]  
        Return a :class:`~matplotlib.transforms.Bbox` object bounding
        the text and arrow annotation, in display units.

        *renderer* defaults to the _renderer attribute of the text
        object.  This is not assigned until the first execution of
        :meth:`draw`, so you must use this kwarg if you want
        to call :meth:`get_window_extent` prior to the first
        :meth:`draw`.  For getting web page regions, it is
        simpler to call the method after saving the figure. The
        *dpi* used defaults to self.figure.dpi; the renderer dpi is
        irrelevant.

        R8   N(
   R{   R   RD  R  R  RQ   R}   R   t   appendt   union(   RV   R8   R  R  t	   text_bboxt   bboxes(    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR}     s    
			N(   R{  R|  R  R   t   dedent_interpdR   R[   R   t   propertyR  t   setterR  R  R  R  R   R  R   R}   (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyR     s"   					e(:   R}  t
   __future__R    R   R   R(   t	   six.movesR   t
   contextlibt   loggingR   R  R@  t   numpyR/   RX   R   R   R   R   R   t   font_managerR	   R   R
   t   patchesR   R   R   t   textpathR   t
   transformsR   R   R   R   R   R   t	   getLoggerR{  R  R   R   t   contextmanagerR!   R.   RP   RQ   t   interpdR   t   kwdocR;  R[   R  Rr   R  R  R   (    (    (    s.   lib/python2.7/site-packages/matplotlib/text.pyt   <module>   sH   ".
		(    b ~T 