)Uc@ sdZddlmZddlZddlZddlmZddlmZddl j Z ddl m Z ddl m Z mZddlmZdd lmZdd lmZmZmZmZmZddljZdd lmZmZmZmZmZdd l m!Z!dd l m"Z"ddl#j$Z$ddl%m&Z&ddlj'Z'ddl(m)Z)ddl*m+Z+e,dZ-dZ.ej/j0dddZ1de fdYZ2ej/j0de j3e2ej4e2j5j6de2fdYZ7ej/j0de j3e7de8fdYZ9de8fdYZ:de2e:fdYZ;ej/j0de;j5jddl<m=Z=dS( s) Classes for including text in a figure. i(tdivisionN(tcbook(trcParams(tArtist(tis_string_liketmaxdict(t docstring(tFontProperties(t bbox_artisttYAArrowtFancyBboxPatchtFancyArrowPatcht Rectangle(tAffine2DtBboxt TransformtBboxBasetBboxTransformTo(tLine2D(tallow_rasterization(tPath(tFT2Font(t RendererBasecK s-|dk r|j|n|j||S(sEReturn an override dict. See :func:`~pyplot.text' docstring for infoN(tNonetupdate(toverridetfontdicttkwargs((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt_process_text_args!s  cC s>|dkrd}n!|dkr*d}n t|}|dS(sy Return the text angle as float. *rotation* may be 'horizontal', 'vertical', or a numeric value in degrees. t horizontalgtverticalgV@ihN(RN(Rtfloat(trotationtangle((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt get_rotation+s      tTextsu ========================== ========================================================================= Property Value ========================== ========================================================================= alpha float or None animated [True | False] backgroundcolor any matplotlib color bbox rectangle prop dict plus key 'pad' which is a pad in points clip_box a matplotlib.transform.Bbox instance clip_on [True | False] color any matplotlib color family [ 'serif' | 'sans-serif' | 'cursive' | 'fantasy' | 'monospace' ] figure a matplotlib.figure.Figure instance fontproperties a matplotlib.font_manager.FontProperties instance horizontalalignment or ha [ 'center' | 'right' | 'left' ] label any string linespacing float lod [True | False] multialignment ['left' | 'right' | 'center' ] name or fontname string eg, ['Sans' | 'Courier' | 'Helvetica' ...] position (x,y) rotation [ angle in degrees 'vertical' | 'horizontal' rotation_mode [ None | 'anchor'] size or fontsize [ size in points | relative size eg 'smaller', 'x-large' ] style or fontstyle [ 'normal' | 'italic' | 'oblique'] text string transform a matplotlib.transform transformation instance variant [ 'normal' | 'small-caps' ] verticalalignment or va [ 'center' | 'top' | 'bottom' | 'baseline' ] visible [True | False] weight or fontweight [ 'normal' | 'bold' | 'heavy' | 'light' | 'ultrabold' | 'ultralight'] x float y float zorder any number ========================== ========================================================================= cC s?g}g}|jdtj}tjj| }x|j|dD]t\}}}} |\} } |j|| f\} } | | | | }}|j| |g|j| |gqMWt |t |}}t ||t ||}}tjj|}|j||f\}}||||fS(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. gf@i( R"tmathtpit mtransformsR trotatet _get_layoutttransform_pointtextendtmintmax(ttexttrenderert projected_xst projected_ystthetattrtttwhtxtytwthtxt1tyt1txt2tyt2txt_boxtyt_boxtw_boxth_boxtx_boxty_box((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt _get_textboxjs& !c B seZdZdZedZdZddddOdddOdOdOdOdOdOd Zd Z d Z d Z d Z d Z dZdZdZdZdZdZdZdZdZedZdZdZdZdZdZdZdZdZ 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/Z0dOdOd0Z1d1Z2d2Z3d3Z4d4Z5d5Z6d6Z7d7Z8d8Z9d9Z:d:Z;d;Z<d<Z=d=Z>d>Z?d?Z@d@ZAdAZBdBZCdCZDdDZEdEZFdFZGdGZHdHZIdIZJdJZKdKZLeMdLZNdMZOdNZPRS(PsK Handle storing and drawing of text in window or data coordinates. ii2cC s d|j|jt|jfS(NsText(%g,%g,%s)(t_ytreprt_text(tself((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt__str__sittbaselinetleftc K stj||||_|_|dkr9td}n|dkrQt}nt|rlt|}n|j| |j ||j |||_ ||_ ||_ | |_||_d|_d|_d|_| dkrd} n| |_|j| |j| dS(s Create a :class:`~matplotlib.text.Text` instance at *x*, *y* with string *text*. Valid kwargs are %(Text)s s text.colorg333333?N(Rt__init__t_xRDRRRRtset_path_effectstset_textt set_colort_verticalalignmentt_horizontalalignmentt_multialignmentt _rotationt_fontpropertiest_bboxt _bbox_patcht _renderert _linespacingtset_rotation_modeR(RGR5R6R-tcolortverticalalignmentthorizontalalignmenttmultialignmenttfontpropertiesR t linespacingt rotation_modet path_effectsR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRLs0                   c C st|jr|j||S|j s;|jdkrEtifS|jj\}}}}||}||}||f||f||f||ff}|j|j } } t j | | |} | ifS(sTest 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. N( tcallablet _containst get_visibleRXRtFalsetget_window_extenttboundsR5R6tnxutilstpnpoly( RGt mouseeventtltbR7R8trR3txyvertsR5R6tinside((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytcontainss   *cC s+|j\}}|jj||fS(sDget the (possibly unit converted) transformed x, y in display coords(t get_positiont get_transformR)(RGR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt_get_xy_displayscC s!|jdk r|jS|jSdS(N(RSRRR(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt_get_multialignmentscC s t|jS(s)return the text angle as float in degrees(R"RT(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR"scC s>|dks|dkr$||_ntdt|dS(s1 set text rotation mode. If "anchor", the un-rotated text will first aligned according to their *ha* and *va*, and then will be rotated with the alignement reference point as a origin. If None (default), the text will be rotated first then will be aligned. tanchortdefaultsUnknown rotation_mode : %sN(Rvsdefault(Rt_rotation_modet ValueErrorRE(RGtm((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRZs cC s|jS(sget text rotation mode(Rx(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_rotation_modescC sztj|||j|_|j|_|j|_|j|_|jj|_|j|_|j |_ |j |_ dS(s"Copy properties from other to selfN( Rt update_fromt_colorRSRQRRRUtcopyRTt_pickerRY(RGtother((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR|s      c1 s|j}||jkr&|j|Sg}d\}}d\}}d\}} |jjd} tjt| df} tjt| df}|jrddlm } t | rfd} qfd} n j } | d |j d t \}}}||j}d }xt| D]\}}|j|\}}|r| ||j d |\}}}nd\}}}||f| |dS|jd|j|j|\}}|j}t|j |j }t|j |j }|j ||f\}}|j\}}|jr|j|||n|j} | j|j| j|j| j|j|j| |jr_t|||jn|j} tdrdx|D]\} } } }tj|  s|tj| rq|n| |} ||}|jr||}n|j | \}}|j!r>xX|j!D](}|j"|| | |||j#| qWq||j"| | |||j#| q|Wnx|D]\} } } }tj|  sktj| rqkn| |} ||}|jr||}n|j | \}}|j!r3xd|j!D].}|j$|| | |||j#| d|qWqk|j$| | |||j#| d|qkW| j%|j&ddS(sI Draws the :class:`Text` object to the given *renderer*. NRIR-s text.usetexR('RRXReRt open_grouptget_gidR(RsRRRMRRDR)tget_canvas_width_heightRWRtnew_gctset_foregroundt get_colort set_alphat get_alphatset_urlt_urlt _set_gc_clipRVRR"RRtisfinitetflipyRRtdraw_texRUt draw_texttrestoret close_group(RGR.RtinfoRRRtcanvaswtcanvashtgcR!RR4R5R6RRt path_effect((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRsp                          cC s|jS(sReturn the color of the text(R}(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRTscC s|jS(s7Return the :class:`~font_manager.FontProperties` object(RU(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_fontpropertiesXscC s|jS(salias for get_fontproperties(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_font_properties\scC s |jjS(s5Return the list of font families used for font lookup(RUt get_family(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR`scC s |jS(salias for get_family(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_fontfamilydscC s |jjS(sReturn the font name as string(RUtget_name(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRhscC s |jjS(sReturn the font style as string(RUt get_style(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRlscC s |jjS(sReturn the font size as integer(RUtget_size_in_points(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRpscC s |jjS(s#Return the font variant as a string(RUt get_variant(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRtscC s |jS(salias for get_variant(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_fontvariantxscC s |jjS(s'Get the font weight as string or number(RUt get_weight(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR|scC s |jS(salias for get_name(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt get_fontnamescC s |jS(salias for get_style(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt get_fontstylescC s |jS(salias for get_size(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt get_fontsizescC s |jS(salias for get_weight(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_fontweightscC s |jjS(s*Get the font stretch as a string or number(RUt get_stretch(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRscC s |jS(salias for get_stretch(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_fontstretchscC s |jS(s!alias for get_horizontalalignment(tget_horizontalalignment(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_hascC s|jS(sq Return the horizontal alignment as string. Will be one of 'left', 'center' or 'right'. (RR(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRscC s:t|j|j}t|j|j}||fS(s5Return the position of the text as a tuple (*x*, *y*)(RRRMRRD(RGR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRrsc C sd|j\}}|||j|j|j|jt|j|j|j|j j t |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 (eg layouts) and need to know if the text has changed. ( RrRR}RQRRthashRURTRxtfiguretdpitidRX(RGR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs    cC s|jS(sGet the text as string(RF(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRscC s |jS(s&alias for :meth:`getverticalalignment`(tget_verticalalignment(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_vascC s|jS(s{ Return the vertical alignment as string. Will be one of 'top', 'center', 'bottom' or 'baseline'. (RQ(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRsc C s)|jstjS|dk r=|jj}||j_n|jdkrw|j\}}tj||ddS|dk r||_ n|j dkrt dn|j |j \}}|j \}} |j j|| f\}} |j|| }|dk 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. RIis%Cannot get window extent w/o rendererN(ReRtunitRRRRRtRRXt RuntimeErrorR(RrRsR)t translated( RGR.Rtdpi_origttxttyRRR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRgs&     ! cC sG|jdkr*td|d||_n|jjtd|dS(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(RVRtdictR(RGR[((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_backgroundcolors cC s;yt|Wntk r-t|}nX||_dS(s] Set the foreground color of the text ACCEPTS: any matplotlib color N(Rt TypeErrorttupleR}(RGR[((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRPs  cC s|j|dS(s!alias for set_horizontalalignmentN(tset_horizontalalignment(RGtalign((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_hascC s8d}||kr+tdt|n||_dS(sj Set the horizontal alignment to one of ACCEPTS: [ 'center' | 'right' | 'left' ] RRRKs&Horizontal alignment must be one of %sN(scentersrightRK(RytstrRR(RGRtlegal((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs cC s|j|dS(salias for set_verticalalignmentN(tset_multialignment(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_ma!scC s8d}||kr+tdt|n||_dS(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' ] RRRKs&Horizontal alignment must be one of %sN(scentersrightsleft(RyRRS(RGRR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR&s  cC s ||_dS(s Set the line spacing as a multiple of the font size. Default is 1.2. ACCEPTS: float (multiple of font size) N(RY(RGtspacing((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_linespacing4scC s|jj|dS(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(RUt set_family(RGtfontname((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR=s cC s|jj|dS(sv Set the font variant, either 'normal' or 'small-caps'. ACCEPTS: [ 'normal' | 'small-caps' ] N(RUt set_variant(RGtvariant((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR IscC s |j|S(salias for set_variant(R (RGR!((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_fontvariantQscC s |j|S(salias for set_family(R(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_nameUscC s|j|dS(salias for set_familyN(R(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_fontnameYscC s|jj|dS(sZ Set the font style. ACCEPTS: [ 'normal' | 'italic' | 'oblique'] N(RUt set_style(RGt fontstyle((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR%]scC s |j|S(salias for set_style(R%(RGR&((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_fontstyleescC s|jj|dS(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(RUtset_size(RGtfontsize((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR(iscC s |j|S(salias for set_size(R((RGR)((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_fontsizerscC s|jj|dS(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(RUt set_weight(RGtweight((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR+vscC s |j|S(salias for set_weight(R+(RGR,((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_fontweight~scC s|jj|dS(s 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(RUt set_stretch(RGtstretch((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR.scC s |j|S(salias for set_stretch(R.(RGR/((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_fontstretchscC s&|j|d|j|ddS(sQ Set the (*x*, *y*) position of the text ACCEPTS: (x,y) iiN(tset_xtset_y(RGtxy((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_positionscC s ||_dS(sJ Set the *x* position of the text ACCEPTS: float N(RM(RGR5((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR1scC s ||_dS(sJ Set the *y* position of the text ACCEPTS: float N(RD(RGR6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR2scC s ||_dS(sq Set the rotation of the text ACCEPTS: [ angle in degrees | 'vertical' | 'horizontal' ] N(RT(RGts((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_rotationscC s|j|dS(salias for set_verticalalignmentN(tset_verticalalignment(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_vascC s8d}||kr+tdt|n||_dS(sk Set the vertical alignment ACCEPTS: [ 'center' | 'top' | 'bottom' | 'baseline' ] RtbottomRRJs$Vertical alignment must be one of %sN(stopR9scentersbaseline(RyRRQ(RGRR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR7s cC sd|f|_dS(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(RF(RGR5((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyROscC s\tdr)|dkrd}n|dfStj|rB|tfS|jddtfSdS(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.usetext s\ tTeXs\$t$N(RRRtTruetreplaceRf(R5((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs     cC s.t|rt|}n|j|_dS(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(RRR~RU(RGtfp((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_fontpropertiess cC s|j|dS(salias for set_fontpropertiesN(R@(RGR?((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_font_propertiessN(Qt__name__t __module__t__doc__tzorderRRRHRRLRqRtRuR"RZR{R|R(RNRRRRRRRRRRRRRRRRRRRRRRRRRRRrRRRRRgRRPRRRRRRR R"R#R$R%R'R(R*R+R-R.R0R4R1R2R6R8R7ROt staticmethodRR@RA(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR#s    $        $   R                        *                  t TextWithDashcB seZdZdZdZddddddddddddddddZd Zd Zd Zd Z dd Z dZ dZ dZ dZdZdZdZdZdZdZdZdZdZdZdZdZRS(s_ 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 textwithdashcC s d|j|jt|jfS(NsTextWithDash(%g,%g,%s)(RMRDRERF(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRH*siRIRgicC stj|d|d|d|d|d|d|d|d|d | d |  td ||fd ||fdd dd|_t||_t||_| |_| |_| |_ ||_ ||_ dS(NR5R6R-R[R\R]R^R_R R`txdatatydatatkt linestylet-( R#RLRtdashlineRt_dashxt_dashyt _dashlengtht_dashdirectiont _dashrotationt_dashpadt _dashpush(RGR5R6R-R[R\R]R^R_R R`t dashlengtht dashdirectiont dashrotationtdashpadtdashpush((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRL,s$$      cC s:t|j|j}t|j|j}||fS(s5Return the position of the text as a tuple (*x*, *y*)(RRRORRP(RGR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRrWscC scgtj|D] }|^q}|j|j|j|j|j|j|j|j gt |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 (eg layouts) and need to know if the text has changed. ( R#RR*RMRDRQRRRSRTRUR(RGtpR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR]s"7cC sF|j|tj|||jdkrB|jj|ndS(sP Draw the :class:`TextWithDash` object to the given *renderer*. gN(t update_coordsR#Rtget_dashlengthRN(RGR.((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRis c!C s|j\}}|j}|dkrA|||_|_dS|j}|j}|j}|j}t|} t j | d|d} t j | t j | } } |j } | j||f}t j| | g}|||}||||}| j}|jt|\}}|jt|\}}|jj||f||ftj|d|}|j|j}}| dkr|}d}na| dkrd}|}nF| | }|}||}||ks|| kr|}||}nt j||gd}|d|t jt j||9}||dd|}|jt|\}} || |_|_tj|d|}|j|_|jjt j|gttj|dtj|ddS(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. gNgf@iR.iR( RrR]RMRDtget_dashrotationtget_dashdirectiont get_dashpadt get_dashpushR"RR%tcostsinRsR)RtinvertedRRNtset_dataR#RgRRtsqrttdottfrozent_twd_window_extenttupdate_from_data_xyRfRR7(!RGR.tdashxtdashyRVRXRWRYRZR!R1t cos_thetat sin_thetaRtcxytcdtc1tc2tinversetx1ty1tx2ty2tweR7R8tdxtdyt tan_thetatcwdtcwtnewxtnewy((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR\rsZ                'cC s=|j||jdkr2tj|d|S|jSdS(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. gR.N(R\R]R#RgRi(RGR.((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRgs cC s|jS(s- Get the length of the dash. (RQ(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR]scC s ||_dS(sT Set the length of the dash. ACCEPTS: float (canvas units) N(RQ(RGtdl((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_dashlengthscC s|jS(sO Get the direction dash. 1 is before the text and 0 is after. (RR(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR_scC s ||_dS(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(RR(RGtdd((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_dashdirections cC s$|jdkr|jS|jSdS(s: Get the rotation of the dash in degrees. N(RSRR"(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR^s cC s ||_dS(s\ Set the rotation of the dash, in degrees ACCEPTS: float (degrees) N(RS(RGtdr((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytset_dashrotationscC s|jS(sW Get the extra spacing between the dash and the text, in canvas units. (RT(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR` scC s ||_dS(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(RT(RGtdp((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_dashpadscC s|jS(sr Get the extra spacing between the dash and the specified text position, in canvas units. (RU(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRascC s ||_dS(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(RU(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt set_dashpush!scC s&|j|d|j|ddS(sd Set the (*x*, *y*) position of the :class:`TextWithDash`. ACCEPTS: (x, y) iiN(R1R2(RGR3((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR4,scC st||_dS(s\ Set the *x* position of the :class:`TextWithDash`. ACCEPTS: float N(RRO(RGR5((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR15scC st||_dS(s\ Set the *y* position of the :class:`TextWithDash`. ACCEPTS: float N(RRP(RGR6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR2=scC s$tj|||jj|dS(s Set the :class:`matplotlib.transforms.Transform` instance used by this artist. ACCEPTS: a :class:`matplotlib.transforms.Transform` instance N(R#RRN(RGR3((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyREscC s|jS(s0return the figure instance the artist belongs to(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt get_figureOscC s$tj|||jj|dS(s~ Set the figure instance the artist belong to. ACCEPTS: a :class:`matplotlib.figure.Figure` instance N(R#t set_figureRN(RGtfig((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRSsN(RBRCRDRHRRLRrRRR\RgR]RR_RR^RR`RRaRR4R1R2RRR(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRGsJ2     T          t OffsetFromcB s8eZddZdZdZdZdZRS(tpointscC s#||_||_|j|dS(N(t_artistt _ref_coordtset_unit(RGtartistt ref_coordR ((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRL`s  cC s|dkst||_dS(NRtpixels(RR(tAssertionErrort_unit(RGR ((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRescC s|jS(N(R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_unitiscC s-|j}|dkrdS|jdSdS(NRg?(RR(RGR.R ((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt _get_scalels  c C s1t|jtrh|jj|}|j\}}}}|j\}}||||||} } nt|jtr|jj\}}}}|j\}}||||||} } n<t|jtr|jj|j\} } n t d|j |} t j | | j | | } | S(Ns unknown type(RRRRgRhRRRR)R RR tscaleR( RGR.RRlRmR7R8txftyfR5R6tscR2((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt__call__ss   !(RBRCRLRRRR(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR_s     t_AnnotationBasecB steZd dd d dZdZdZdZdZdZdZ dZ d Z d e d Z RS( tdatacC sr|dkr|}n|dkr*|}n|\}}|_||_||_||_|j|d|_dS(N(RtxytextR3txycoordst textcoordstset_annotation_clipt _draggable(RGR3RRRtannotation_clipR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRLs        c C st|tr|\}}n ||}}|dkrOt|j|}n|dkrst|j|}n|dkr|j||||S|j||}|j||f\}} || fS(NRs axes pointss axes pixels figure pointss figure pixel(s axes pointss axes pixels figure pointss figure pixel(RRRRRt_get_xy_legacyt_get_xy_transformR)( RGR.R5R6R5ts1ts2R2RtRu((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt_get_xys    cC skt|trb|\}}ddlm}|j||}|j||}|||}|St|r||}t|trt|St|tr|St dnt|t r|j |} t| St|trt|St|tr |St |s+t d|fn|dkrA|j jS|dkr}ddlm} | j}||j j} | S|j} t| dkrtd |nd\} }| \}}|d kr|jj} n|d kr|j j} n| dk r| jd }n|d kr6|j|}n|dk rW|\}}dd lm}|dkr|jj}|j|d|d}n|dkr|}n|dkr|j}|jj}|j||d||d}nG|dkr7| jd\}}|j||}ntd ||j||Std |dS(Ni(tblended_transform_factorysunknown return type ...sunknown coordinate type : %sRtpolar(t PolarAxesis %s is not a recognized coodinateRtaxestoffset(R RgR@RR)tfraction(NN(RRtmatplotlib.transformsRRRcRRRR RRgRRt transDatatmatplotlib.projectionsRtPolarTransformRRRyRRRRht _get_ref_xyR tget_dpiRRR(RGR.R5RRRttr1ttr2R2RRRts_tbbox0txy0t bbox_nameR tref_xtref_yR RR)R7R8((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRsz                          ( c C s,t|jtr|j\}}t|rC|jddkset|rt|jddkrttdn|j\}}|j||||\}}|j||||\}} || fSt|jr|jjddkrtdn(|j\}}|j||||jSdS(sy return x, y (in display coordinate) that is to be used for a reference of any offset coordinate iRs+xycoords should not be an offset coordinateN(RRRRRRyR3R( RGR.RRR5R6RtRuRvRw((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs"" (cC s|j}d \}}|\}} |dkr?|jj}n|dkrZ|jj}n| dkr||jjd} n| dkrd} n|j\} } } }|dkr| || }n| || }|dkr||| }n| || }||fS( se only used when s in ['axes points', 'axes pixel', 'figure points', 'figure pixel']. RRRgR@RiiN(NN(RRRRRRtextents(RGR.R5R6R5RRRRR RRlRmRnR3((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR"s&          cC s ||_dS(s) 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(RGRm((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRAscC s|jS(s Return *annotation_clip* attribute. See :meth:`set_annotation_clip` for the meaning of return values. (R(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytget_annotation_clipKscC s(|j\}}|j||||jS(s5Return the pixel position of the the annotated point.(R3RR(RGR.R5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt_get_position_xyRscC sJ|j}|s-|dkrF|jdkrF|jj|sFtSntS(sb given the xy pixel coordinate, check if the annotation need to be drawn. RN(RRRRtcontains_pointRfR=(RGR.txy_pixelRm((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt _check_xyWs  !cC sddlm}|jdk }|dkr5| }n|rb|jdkr||||_qn(|jdk r|jjnd|_|jS(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(tDraggableAnnotationN(tmatplotlib.offsetboxRRRt disconnect(RGtstatetuse_blitRt is_draggable((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyt draggablegs   N(RBRCRRLRRRRRRRRRfR(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs   S "    t AnnotationcB steZdZdZejd dd d d dZdZdZ dZ dZ dZ e d ZRS( s A :class:`~matplotlib.text.Text` class to make annotating things in the figure, such as :class:`~matplotlib.figure.Figure`, :class:`~matplotlib.axes.Axes`, :class:`~matplotlib.patches.Rectangle`, etc., easier. cC s(d|jd|jdt|jfS(NsAnnotation(%g,%g,%s)ii(R3RERF(RG((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRHsRc K stj||d|d|d|d||j\} } tj|| | ||||_d |_|r|jdr|jdd |_ t d d ||_ n d |_ d S(s Annotate the *x*, *y* point *xy* with text *s* at *x*, *y* location *xytext*. (If *xytext* = *None*, defaults to *xy*, and if *textcoords* = *None*, defaults to *xycoords*). *arrowprops*, if not *None*, is a dictionary of line properties (see :class:`matplotlib.lines.Line2D`) for the arrow that connects annotation to the point. If the dictionary has a key *arrowstyle*, a FancyArrowPatch instance is created with the given dictionary and is drawn. Otherwise, a YAArow patch instance is created and drawn. Valid keys for YAArow are ========= ============================================================= Key Description ========= ============================================================= 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 shrink oftentimes it is convenient to have the arrowtip and base a bit away from the text and point being annotated. If *d* is the distance between the text and annotated point, shrink will shorten the arrow so the tip and base are shink percent of the distance *d* away from the endpoints. ie, ``shrink=0.05 is 5%%`` ? any key for :class:`matplotlib.patches.polygon` ========= ============================================================= Valid keys for 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` =============== ====================================================== *xycoords* and *textcoords* are strings that indicate the coordinates of *xy* and *xytext*. ================= =================================================== Property Description ================= =================================================== 'figure points' points from the lower left corner of the figure 'figure pixels' pixels from the lower left corner of the figure 'figure fraction' 0,0 is lower left of figure and 1,1 is upper, right 'axes points' points from lower left corner of axes 'axes pixels' pixels from lower left corner of axes 'axes fraction' 0,1 is lower left of axes and 1,1 is upper right 'data' use the coordinate system of the object being annotated (default) 'offset points' Specify an offset (in points) from the *xy* value 'polar' you can specify *theta*, *r* for the annotation, even in cartesian plots. Note that if you are using a polar axes, you do not need to specify polar for the coordinate system since that is the native "data" coordinate system. ================= =================================================== If a 'points' or 'pixels' option is specified, values will be added to the bottom-left and if negative, values will be subtracted from the top-right. Eg:: # 10 points to the right of the left border of the axes and # 5 points below the top border xy=(10,-5), xycoords='axes points' You may use an instance of :class:`~matplotlib.transforms.Transform` or :class:`~matplotlib.artist.Artist`. See :ref:`plotting-guide-annotation` for more details. The *annotation_clip* attribute contols 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". Additional kwargs are Text properties: %(Text)s RRRRt arrowstyletrelposg?iiN(g?g?(ii(ii( RRLRR#t arrowpropsRtarrowthas_keyRt _arrow_relposR t arrow_patch( RGR5R3RRRRRRR5R6((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRLsm      cC sXtj||\}}|jdk rN|jj|\}}|pH|}n||fS(N(R#RqRR(RGteventR3ttinfotatainfo((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRqs cC sX|jdk r"|jj|n|jdk rD|jj|ntj||dS(N(RRRRR(RGR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs cC s#|j|}|j||dS(s?Update the pixel positions of the annotated point and the text.N(Rt_update_position_xytext(RGR.R((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytupdate_positions&sc$ C s|j\}}|j||||j\|_|_|\}}|j|j}}||}}|jr||} } |j|j\} } } }| | }| |}d| |}d| |}|jj}|j r|j }|j|}|j |j |d}|j |j|d}|j j||f||f|jd|j}|j|}|j j|d|kr|j j|jdq|jr|j j|jq|jdd }|j}|d kri}n|j}|jdd}|j|}|jdkrF|j jd d S|j|}|j\} } } }| |d 8} | |d 8} | |7} ||7}td | | fd | d |}|jtj|jt|j||j j|qg| ||fD]}t || |f^q }|j!|d\}}g| ||fD]}t || |f^qW}|j!|d\}}|jdd}t"j#|| || }t"j$|| d || d }||t"j%|}||t"j&|} |jd d}!|jdd}"|jdd}#t'|j(| || | f|||| fd |!d|"d|#||_)|j)j*|j+nd S(sFUpdate the pixel positions of the annotation text and the arrow patch.g?iitmutation_scaletpatchAtpadiRINg@R3RRtshrinkgt headwidthi tfracg?(,RRRRMRDRRgRhR~RRtx0Rty0Rt set_positionsRRRRt set_patchARWRRVRR RR&Rt set_clip_onRfRtabstsortR$tatan2RfRbRcR RRt set_clip_boxt get_clip_box($RGR.RR5R6tox0toy0tox1toy1RRRlRmR7R8RnR3txctycRRRRRRRtvaltdsut_RR1RyRzRRR((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyR,s                  2 2 #. c C st|jtsdS|jr|j|j}}t||\}}}}|jjdd|||jdt j }t j j |} | j||||} |jj| |j|j} |jj| ndS(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. Nggf@(RRR RWRMRDRCRR"R$R%R&R R'RRRRR( RGR.RRRARBR?R@R1R2R((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs   cC s(|dk r||_n|js(dS|j|}|j||sMdS|j|||j||jdk r|jjdkr|jdk r|j|j_n|jj |n|j dk r|j jdkr|jdk r|j|j _n|j j |nt j ||dS(sN Draw the :class:`Annotation` object to the given *renderer*. N( RRXReRRRRRRRRR#(RGR.R((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs$    !!N(RBRCRDRHRtdedent_interpdRRLRqRRRRRR(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pyRs |  n (tTextPath(>RDt __future__RR$tnumpyRt matplotlibRRtmatplotlib.artistRRtmatplotlib.cbookRRRtmatplotlib.font_managerRtmatplotlib.patchesRR R R R Rt transformsR&R RRRRtmatplotlib.linesRRtmatplotlib.nxutilsRitmatplotlib.pathRt font_managertmatplotlib.ft2fontRtmatplotlib.backend_basesRRRR"tinterpdRRCR#tkwdocRRLtim_funcRGtobjectRRRtmatplotlib.textpathR(((sB/opt/alt/python27/lib64/python2.7/site-packages/matplotlib/text.pytsR  ((  # #gh(Q