
    h                    D   S r SSKrSSKrSSKrSSKJr  SSKrSSKrSSK	r
SSKJrJrJrJr  SSKJr  SSKJr  SSKJrJrJr  SS	KJrJr  SS
KJrJrJrJrJrJ r   \RB                  " \"5      r#S r$S r%\RL                  " S5      S 5       r'\RP                  \RR                  " S/SS/S/S/S/S/S/S/S/S/S/S/S.5       " S S\5      5       5       r* " S S 5      r+ " S! S"5      r, " S# S$\*\,5      r-\RP                  R]                  \-R^                  R                   S%9  g)&z)
Classes for including text in a figure.
    N)Real   )_apiartistcbook
_docstring)Artist)FontProperties)FancyArrowPatchFancyBboxPatch	Rectangle)TextPath
TextToPath)Affine2DBboxBboxBaseBboxTransformToIdentityTransform	Transformc                 *   / n/ n[         R                  " U R                  5       5      n[        5       R	                  U* 5      nU R                  U5      u  pgnU HS  u  ppU
u  pUR                  X45      u  nnUU-  nX-   UU-   nnUR                  UU/5        UR                  UU/5        MU     [        U5      [        U5      nn[        U5      U-
  [        U5      U-
  nn[        5       R	                  U5      R                  UU45      u  nnUUUU4$ )z
Calculate the bounding box of the text.

The bbox position takes text rotation into account, but the width and
height are those of the unrotated box (unlike `.Text.get_window_extent`).
)
npdeg2radget_rotationr   rotate_get_layout	transformextendminmax)textrendererprojected_xsprojected_ysthetatr_partsdtwhxywhxt1yt1xt2yt2xt_boxyt_boxw_boxh_boxx_boxy_boxs                            A/var/www/html/env/lib/python3.13/site-packages/matplotlib/text.py_get_textboxr:      s    LLJJt((*+E			E6	"B""8,KAaq<<'Sq7C!GSS#J'S#J'  &L(9FF|$v-s</@6/I5E:$$U+55vv6FGLE5%%%    c                 `    [        [        R                  " U 5      XR                  5       X45      $ )zECall ``renderer.get_text_width_height_descent``, caching the results.)!_get_text_metrics_with_cache_implweakrefrefcopy)r!   r    fontpropismathdpis        r9   _get_text_metrics_with_cacherD   A   s)     -Ht]]_fC Cr;   i   c                 0    U " 5       R                  XU5      $ N)get_text_width_height_descent)renderer_refr    rA   rB   rC   s        r9   r=   r=   I   s     >77OOr;   cfontfont_propertiesfamilynamesizestretchstylevariantweighthavama)colorfontproperties
fontfamilyfontnamefontsizefontstretch	fontstylefontvariant
fontweighthorizontalalignmentverticalalignmentmultialignmentc                     ^  \ rS rSrSrSr\" 5       rS r STSSSSSSSSSSSSSS	.U 4S
 jjjr	              SUS jr
U 4S jrU 4S jrS rS rS rS rS rS rS rS rS rS rU 4S jrS rS rS rS rS rU 4S jrSVU 4S jjrU 4S  jrS! r S" r!S# r"S$ r#S% r$S& r%\&RN                  S' 5       r(S( r)S) r*S* r+S+ r,S, r-S- r.S. r/S/ r0S0 r1S1 r2S2 r3S3 r4S4 r5S5 r6SWS6 jr7S7 r8S8 r9S9 r:S: r;S; r<S< r=S= r>S> r?S? r@S@ rASA rBSB rCSC rDSD rESE rFSF rGSG rHSH rISI rJSJ rKSK rLSL rM\NR                  " SM5      SN 5       rPSO rQSP rRSQ rSSR rTSSrUU =rV$ )XTextP   zAHandle storing and drawing of text in window or data coordinates.   c                 X    SU R                    SU R                   SU R                  < S3$ )NzText(, ))_x_y_textselfs    r9   __repr__Text.__repr__e   s)    twwir$''"TZZN!<<r;   NbaselineleftF)rV   r`   r_   ra   rW   rotationlinespacingrotation_modeusetexwraptransform_rotates_text
parse_mathantialiasedc                   > [         TU ]  5         XsU l        U l        SU l        U R                  UUUUUUUUUU	UU
UUS9  U R                  U5        g)a  
Create a `.Text` instance at *x*, *y* with string *text*.

The text is aligned relative to the anchor point (*x*, *y*) according
to ``horizontalalignment`` (default: 'left') and ``verticalalignment``
(default: 'baseline'). See also
:doc:`/gallery/text_labels_and_annotations/text_alignment`.

While Text accepts the 'label' keyword argument, by default it is not
added to the handles of a legend.

Valid keyword arguments are:

%(Text:kwdoc)s
 )r    rV   rW   ru   rx   rv   r`   r_   ra   rr   rw   rs   rt   ry   N)super__init__ri   rj   rk   _reset_visual_defaultsupdate)rm   r+   r,   r    rV   r`   r_   ra   rW   rr   rs   rt   ru   rv   rw   rx   ry   kwargs	__class__s                     r9   r}   Text.__init__h   sq    @ 	
##)!/ 3)#9#'# 	$ 	
  	Fr;   c                 d   U R                  U5        U R                  [        R                  " US5      5        U R	                  U5        U R                  U5        U R                  [        R                  " US5      5        U R                  U5        U R                  U5        U R                  U5        Xl
        U R                  U
5        Xl        S U l        S U l        Uc  SnU R                  U5        U R!                  U5        U R#                  Ub  U5        g [        R$                  S   5        g )Nz
text.colorztext.parse_mathg333333?ztext.antialiased)set_text	set_colormpl
_val_or_rcset_fontproperties
set_usetexset_parse_mathset_wrapset_verticalalignmentset_horizontalalignment_multialignmentset_rotation_transform_rotates_text_bbox_patch	_rendererset_linespacingset_rotation_modeset_antialiasedrcParams)rm   r    rV   rW   ru   rx   rv   r`   r_   ra   rr   rw   rs   rt   ry   s                  r9   r~   Text._reset_visual_defaults   s    " 	ds~~e\:;/CNN:7HIJd""#45$$%89-(#'=$K[)}-K,C[ 	? \\*<=	?r;   c                 j  > / n[         R                  " U[        5      n[        5       nUR	                  SU5      nXCLa   UR                  U R                  U5      5        UR	                  SU5      nUR                  [        TU ]%  U5      5        XSLa   UR                  U R                  U5      5        U$ )NrW   bbox)r   normalize_kwargsrc   objectpopappendr   r   r|   r   set_bbox)rm   r   retsentinelrW   r   r   s         r9   r   Text.update   s    ''58$4h?)JJt..~>?zz&(+

57>&)*JJt}}T*+
r;   c                 .   > [         TU ]  5       nS US'   U$ )Nr   )r|   __getstate__)rm   r(   r   s     r9   r   Text.__getstate__   s    G "+r;   c                    U R                  U5      (       d"  U R                  5       (       a  U R                  c  S0 4$ [        R	                  U 5      nUR
                  UR                  s=:*  =(       a    UR                  :*  Os  =(       a3    UR                  UR                  s=:*  =(       a    UR                  :*  Os  n0 nU R                  (       a,  U R                  R                  U5      u  pVU=(       d    UnXdS'   X44$ )z[
Return whether the mouse event occurred inside the axis-aligned
bounding-box of the text.
F
bbox_patch)_different_canvasget_visibler   rc   get_window_extentx0r+   x1y0r,   y1r   contains)rm   
mouseeventr   insidecattrpatch_insidepatch_cattrs          r9   r   Text.contains   s    
 "":..d6F6F6H6H>>)"9 %%d+''Z\\44TWW4 9gg888 	 (,(8(8(A(A*(M%L+|F"-,}r;   c                 f    U R                  5       u  pU R                  5       R                  X45      $ )zG
Get the (possibly unit converted) transformed x, y in display coords.
)get_unitless_positionget_transformr   rm   r+   r,   s      r9   _get_xy_displayText._get_xy_display   s0     ))+!!#--qf55r;   c                 L    U R                   b  U R                   $ U R                  $ rF   )r   _horizontalalignmentrl   s    r9   _get_multialignmentText._get_multialignment   s&    +''',,,r;   c                    U R                   (       d  gU R                   n[        U R                  5      nU[        R                  ;  a  [        5       [        R                  U'   [        R                  U   n[        U5       HF  nXT;  d  M
  U R                  U5        U R                  5       nUR                  UR                  -
  XE'   MH     U R                  U5        U R                  5       n[        R                  " S/U Vs/ s H  oU   PM	     sn-   5      nWUR                  -
  n[        R                  " Xx-
  5      R                  5       $ s  snf )z
Calculate the index closest to the coordinate x in display space.

The position of text[index] is assumed to be the sum of the widths
of all preceding characters text[:index].

This works only on single line texts.
r   )rk   str_fontpropertiesrc   _charsize_cachedictsetr   r   r   r   r   cumsumabsargmin)	rm   r+   r    rW   charsize_cachecharbb
size_accumstd_xs	            r9   _char_index_atText._char_index_at   s
    zzzzT112!5!55376D  0--n=ID)d#++-')uuruu}$	  	d##%YYs%FAQ&7%FFG
BEE	z)*2244 &Gs   E
c                     U R                  5       (       aI  U R                  5       R                  U R                  /U R	                  5       /5      R                  S5      $ U R                  $ )z3Return the text angle in degrees between 0 and 360.r   )get_transform_rotates_textr   transform_angles	_rotationr   itemrl   s    r9   r   Text.get_rotation  s\    **,,%%'88 4#=#=#?"@BBF$q'J >>!r;   c                     U R                   $ )zF
Return whether rotations of the transform affect the text direction.
)r   rl   s    r9   r   Text.get_transform_rotates_text$  s     +++r;   c                 T    Uc  SnO[         R                  " SUS9  Xl        SU l        g)aM  
Set text rotation mode.

Parameters
----------
m : {None, 'default', 'anchor'}
    If ``"default"``, the text will be first rotated, then aligned according
    to their horizontal and vertical alignments.  If ``"anchor"``, then
    alignment occurs before rotation. Passing ``None`` will set the rotation
    mode to ``"default"``.
Ndefault)anchorr   )rt   T)r   check_in_list_rotation_modestale)rm   ms     r9   r   Text.set_rotation_mode*  s,     9A4AF
r;   c                     U R                   $ )zReturn the text rotation mode.)r   rl   s    r9   get_rotation_modeText.get_rotation_mode=  s    """r;   c                     Xl         SU l        g)z
Set whether to use antialiased rendering.

Parameters
----------
antialiased : bool

Notes
-----
Antialiasing will be determined by :rc:`text.antialiased`
and the parameter *antialiased* will have no effect if the text contains
math expressions.
TN)_antialiasedr   )rm   ry   s     r9   r   Text.set_antialiasedA  s     (
r;   c                     U R                   $ )z-Return whether antialiased rendering is used.)r   rl   s    r9   get_antialiasedText.get_antialiasedR  s       r;   c                   > [         TU ]  U5        UR                  U l        UR                  U l        UR                  U l        UR
                  U l        UR                  R                  5       U l        UR                  U l        UR                  U l	        UR                  U l
        UR                  U l        UR                  U l        UR                  U l        SU l        g )NT)r|   update_from_colorr   _verticalalignmentr   r   r@   _usetexr   r   _picker_linespacingr   r   )rm   otherr   s     r9   r   Text.update_fromV  s    E"ll$44"'":":$)$>$>!$4499;}}','D'D$}}!..!..
r;   c                    Su  p#U R                  5       R                  S5      n/ n/ n/ n/ n[        USU R                  U R	                  5       (       a  SOSU R                  SS9R                  S9u  pnX-
  U R                  -  n[        U5       H  u  pU R                  U5      u  nnU(       a2  [        XU R                  UU R                  SS9R                  S9u  nnnOS	=n=nn[        UU
5      n[        UU5      nUR                  U5        UR                  U5        UU-
  U-
  nUS	:X  a  UU-
  * nOU[        UUU-
  U R                  -  5      -  nUR                  U5        UR                  U5        UU-  nM     Wn[        U5      nS	nUnS	nUS
   U-
  n[        5       R                  U R                  5       5      nU R                  5       nUS:X  a#  [!        Xx5       VVs/ s H
  u  nnUU4PM     nnnOkUS:X  a3  [!        XxU5       VVVs/ s H  u  nnnUUS-  -   US-  -
  U4PM     nnnnO2US:X  a,  [!        XxU5       VVVs/ s H  u  nnnUU-   U-
  U4PM     nnnn["        R$                  " UU4UU4UU4UU4/5      n UR'                  U 5      n!U!SS2S	4   R)                  5       nU!SS2S	4   R                  5       nU!SS2S4   R)                  5       nU!SS2S4   R                  5       nUU-
  nUU-
  n"U R*                  n#U R,                  n$U R/                  5       n%U%S:w  aS  U#S:X  a	  UU-   S-  n&OU#S:X  a  Un&OUn&U$S:X  a	  UU-   S-  n'OU$S:X  a  Un'OU$S:X  a  UU-   n'OU$S:X  a  UU"-   WS-  -
  n'OxUn'OuU S	   u  n(n)U S   u  n*n+U#S:X  a	  U(U*-   S-  n&OU#S:X  a  U*n&OU(n&U$S:X  a	  U)U+-   S-  n'O&U$S:X  a  U+n'OU$S:X  a  U+W-
  n'OU$S:X  a	  U+WS-  -
  n'OU)n'UR'                  U&U'45      u  n&n'UU&-  nUU'-  n[0        R2                  " UUUU"5      n,UR'                  W5      U&U'4-
  n-U,[5        [!        U[!        XV5      /U-R6                  Q76 5      U4$ s  snnf s  snnnf s  snnnf )z
Return the extent (bbox) of the text together with
multiple-alignment information. Note that it returns an extent
of a rotated text when necessary.
)        r   
lpTeXFTroot)rB   rC   r   rq   center   rightNr   r   toprp   center_baselineg       @)_get_wrapped_textsplitrD   r   
get_usetex
get_figurerC   r   	enumerate_preprocess_mathr   r   r   
rotate_degr   r   zipr   arrayr   r   r   r   r   r   from_boundslistT).rm   r!   thisxthisylineswshsxsysr&   lp_hlp_dmin_dyiline
clean_linerB   r-   r.   r(   rp   descentwidthxminxmaxymaxyminMmalignr+   r,   offset_layoutcorners_horizcorners_rotatedheighthalignvalignrt   offsetxoffsetyxmin1ymin1xmax1ymax1r   xyss.                                                 r9   r   Text._get_layoutf  s     &&(..t4 5dD00 OO--55T*..0 +!2!22 'GA!%!6!6t!<J6$*>*>!tD'A'E'EG1a A
 AtAAtAIIaLIIaL AHAva% Va!et/@/@%@AAIIeIIeQJE? (D  B"v J!!$"3"3"56 ))+V03B<1aVM<Mx,/O=,;Aq  %!)ma!e3Q7,;  =Mw,/O=,;Aq  %i!mQ/,;  = D\D$<$d|DF ++m4q!t$((*q!t$((*q!t$((*q!t$((*t **((..0H$ !$;!+7"!$;!+5:%.,,-(S.8(+LE5(+LE5! 5=C/7"! 5=C/5:%(*,,(S.0 {{GW+=>GWdE6: kk-(GW+==T#eS[93559:GCCa ===s   'QQ!Q(c                 b   Ub  UR                  5       nUR                  SS5      nUR                  SS5      nUc  SnUc  SnX@R                  5       -  nOUc  Sn[        U[        5      (       a  SU;  a  USU-  -  n[        SU[        5       S	.UD6U l        OSU l        U R                  5         g)
a8  
Draw a bounding box around self.

Parameters
----------
rectprops : dict with properties for `.patches.FancyBboxPatch`
     The default boxstyle is 'square'. The mutation
     scale of the `.patches.FancyBboxPatch` is set to the fontsize.

Examples
--------
::

    t.set_bbox(dict(facecolor='red', alpha=0.5))
Nboxstylepadsquare   g333333?z
,pad=%0.2f)r   r   r   r   )r.  r   )	r@   r   get_size
isinstancer   r   r   r   _update_clip_properties)rm   	rectpropspropsr.  r/  s        r9   r   Text.set_bbox  s    "  NN$EyyT2H))E4(C#;C}}&;C(C((U(-BL3..-  K!->-@ KDI KD  $D$$&r;   c                     U R                   $ )zN
Return the bbox Patch, or None if the `.patches.FancyBboxPatch`
is not made.
)r   rl   s    r9   get_bbox_patchText.get_bbox_patch&  s    
 r;   c                 p   U R                   (       Ga$  [        U R                  U R                  5      5      n[        U R	                  U R
                  5      5      nU R                  5       R                  X#45      u  p#[        X5      u  pEpgU R                   R                  SSXg5        U R                   R                  [        5       R                  U R                  5       5      R                  X$-   X5-   5      5        UR                  U R!                  5       5      nU R                   R#                  U5        gg)z
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.
r   N)r   floatconvert_xunitsri   convert_yunitsrj   r   r   r:   
set_boundsset_transformr   r  r   	translatepoints_to_pixelsr3  set_mutation_scale)	rm   r!   posxposyr7   r8   r5   r6   fontsize_in_pixels	            r9   update_bbox_position_sizeText.update_bbox_position_size-  s      ,,TWW56D,,TWW56D++-77EJD)5d)E&E%''B=**
D--/04<68 !) 9 9$--/ J//0AB r;   c                     U R                   (       aE  [        U R                  U R                  U R                  S9nU R                   R                  U5        g g )N)clip_box	clip_pathclip_on)r   r   clipbox	_clippath_cliponr   )rm   	clippropss     r9   r5  Text._update_clip_propertiesD  sD    dll'+~~%)\\3I ##I.	 r;   c                 D   > [         TU ]  U5        U R                  5         g rF   )r|   set_clip_boxr5  )rm   rN  r   s     r9   rT  Text.set_clip_boxK  s    W%$$&r;   c                 D   > [         TU ]  X5        U R                  5         g rF   )r|   set_clip_pathr5  )rm   pathr   r   s      r9   rW  Text.set_clip_pathP  s    d.$$&r;   c                 D   > [         TU ]  U5        U R                  5         g rF   )r|   set_clip_onr5  )rm   br   s     r9   r[  Text.set_clip_onU  s    A$$&r;   c                     U R                   $ )z'Return whether the text can be wrapped._wraprl   s    r9   get_wrapText.get_wrapZ      zzr;   c                     Xl         g)a  
Set whether the text can be wrapped.

Wrapping makes sure the text is confined to the (sub)figure box. It
does not take into account any other artists.

Parameters
----------
wrap : bool

Notes
-----
Wrapping does not work together with
``savefig(..., bbox_inches='tight')`` (which is also used internally
by ``%matplotlib inline`` in IPython/Jupyter). The 'tight' setting
rescales the canvas to accommodate all content and happens before
wrapping.
Nr_  )rm   rv   s     r9   r   Text.set_wrap^  s	    & 
r;   c                    U R                  5       R                  U R                  5       5      u  pU R                  5       R	                  5       nU R                  5       nU R                  S5        U R                  5       nU R                  XQX#5      nU R                  SU-   S-  XU5      nUS:X  a  UnU$ US:X  a  UnU$ S[        Xg5      -  nU$ )zS
Return the maximum line width for wrapping text based on the current
orientation.
r      h  rq   r   r   )
r   r   get_positionr  r   get_horizontalalignmentr   r   _get_dist_to_boxr   )	rm   r   r   
figure_box	alignmentrr   rq   r   
line_widths	            r9   _get_wrap_line_widthText._get_wrap_line_widths  s    
 ##%//0A0A0CD__&88:
 002	x($$&$$X2B%%8^s"BJ8 J  '!J  S--Jr;   c                    US:  a}  US-
  nX4R                   -
  [        R                  " [        R                  " U5      5      -  nUR                  U-
  [        R                  " [        R                  " SU-
  5      5      -  nGOzUS:  a{  US-
  nX$R
                  -
  [        R                  " [        R                  " U5      5      -  nX4R                   -
  [        R                  " [        R                  " SU-
  5      5      -  nOUS:  a|  US-
  nUR                  U-
  [        R                  " [        R                  " U5      5      -  nX$R
                  -
  [        R                  " [        R                  " SU-
  5      5      -  nOwUR                  U-
  [        R                  " [        R                  " U5      5      -  nUR                  U-
  [        R                  " [        R                  " SU-
  5      5      -  n[        Xg5      $ )zZ
Return the distance from the given points to the boundaries of a
rotated box, in pixels.
i  Z   rg  )r   mathcosradiansr   r   r   r   )rm   rr   r   r   rl  quadh1h2s           r9   rk  Text._get_dist_to_box  sn   
 c>c>D}}$d1C(DDB--"$b4i1H(IIB^c>D}}$d1C(DDB}}$b4i1H(IIB]b=D--"$d1C(DDB}}$b4i1H(IIB--"$h1G(HHB--"$b8m1L(MMB2{r;   c                     U R                   R                  UU R                  5       [        R                  " U5      5      u  p#n[
        R                  " U5      $ )z5
Return the width of a given text string, in pixels.
)r   rG   get_fontpropertiesr   is_math_textrs  ceil)rm   r    r-   r.   r(   s        r9   _get_rendered_text_widthText._get_rendered_text_width  sI    
 ..>>##%t$&a yy|r;   c           
      T   U R                  5       (       d  U R                  5       $ U R                  5       (       a  U R                  5       $ U R                  5       n/ nU R                  5       R	                  S5      nU GH  nUR	                  S5      n[        U5      S:  d  M&  [        U5      S:X  a"  UR                  UR                  S5      5        MB  [        S[        U5      S-   5       H  nSR                  USU 5      nU R                  U5      nX:  a/  UR                  SR                  USUS-
   5      5        XVS-
  S n  O:U[        U5      :X  d  Mm  UR                  SR                  USU 5      5        / n  O   [        U5      S:  a  M  GM     SR                  U5      $ )z
Return a copy of the text string with new lines added so that the text
is wrapped relative to the parent figure (if `get_wrap` is True).
r    r   r   r   N)ra  get_textr   ro  r   lenr   r   rangejoinr~  )	rm   rn  wrapped_linesunwrapped_linesunwrapped_line	sub_wordsr  r  current_widths	            r9   r   Text._get_wrapped_text  s   
 }}==?" ??==?" ..0
 --///5 .N&,,S1Ii.1$y>Q&!((q)9:q#i.1"45A88IbqM2D$($A$A$$GM %1%,,SXXiQ6G-HI$-!ef$5	 c)n,%,,SXXim-DE$&	! 6 i.1$$	 .8 yy''r;   c                    Ub  Xl         U R                  5       (       d  g U R                  5       S:X  a  g UR                  SU R	                  5       5        U R                  U R                  5       S9   U R                  U5      u  p#nU R                  5       nU R                  U R                  pv[        R                  R                  U5      (       a  [        R                  n[        R                  R                  U5      (       a  [        R                  n[        U R!                  U5      5      n[        U R#                  U5      5      n	UR%                  X45      u  p[        R&                  " U5      (       d  [        R&                  " U	5      (       a
   S S S 5        g [        R(                  " U5      (       a  [        R(                  " U	5      (       d  [*        R-                  S5         S S S 5        g UR/                  5       u  pU R0                  (       a,  U R3                  U5        U R0                  R5                  U5        UR7                  5       nUR9                  U R;                  5       5        UR=                  U R?                  5       5        URA                  U RB                  5        URE                  U RF                  5        U RI                  U5        U RK                  5       nU H  u  ppg[M        U5      S:X  a  U OS nXh-   nXy-   nURO                  5       (       a  X-
  nU RQ                  U5      u  nnU RS                  5       (       a  SSK*J+n  U" U RS                  5       U5      nOUnU RY                  5       (       a   UR[                  XUUU R\                  UUS9  M  UR_                  XUUU R\                  UUUS	9  M     S S S 5        WRa                  5         URc                  S5        S
U l2        g ! , (       d  f       N7= f)Nr{   r    )r    z%posx and posy should be finite valuesr   r   )PathEffectRenderer)mtext)rB   r  F)3r   r   r  
open_groupget_gid_cm_setr   r   r   ri   rj   r   rU   	is_maskednanr=  r>  r?  r   isnanisfinite_logwarningget_canvas_width_heightr   rH  drawnew_gcset_foreground	get_color	set_alpha	get_alphaset_url_urlr   r   _set_gc_clipr   r  flipyr  get_path_effectsmatplotlib.patheffectsr  r   draw_texr   	draw_textrestoreclose_groupr   )rm   r!   r   infor  transr+   r,   rE  rF  canvaswcanvashgcangler  r*   r  r  rB   r  textrenderers                        r9   r  	Text.draw  s.    %N!!==?b FDLLN3\\t557\8"&"2"28"<D&&(E 77DGGquuq!!FFuuq!!FF,,Q/0D,,Q/0D$6JDxx~~$ 98  ;;t$$BKK,=,=DE% 98&  (??AG ..x8  %%h/"Bdnn./LL)*JJtyy!t001b!%%'E"&! #D	QDHH>>##A%)%:%:4%@"
F((**I#5--/$;L $,L??$$ ))"J*.*>*>05 * 7 !**2!Z+/+?+?28 + G+ #'I 9z 	

V$
 98s   2D#O5AO53GO55
Pc                     U R                   $ )zReturn the color of the text.)r   rl   s    r9   r  Text.get_color0  s    {{r;   c                     U R                   $ )z*Return the `.font_manager.FontProperties`.)r   rl   s    r9   r{  Text.get_fontproperties4  s    ###r;   c                 6    U R                   R                  5       $ )zs
Return the list of font families used for font lookup.

See Also
--------
.font_manager.FontProperties.get_family
)r   
get_familyrl   s    r9   get_fontfamilyText.get_fontfamily8       ##..00r;   c                 6    U R                   R                  5       $ )z\
Return the font name as a string.

See Also
--------
.font_manager.FontProperties.get_name
)r   get_namerl   s    r9   get_fontnameText.get_fontnameB  s     ##,,..r;   c                 6    U R                   R                  5       $ )z^
Return the font style as a string.

See Also
--------
.font_manager.FontProperties.get_style
)r   	get_stylerl   s    r9   get_fontstyleText.get_fontstyleL  s     ##--//r;   c                 6    U R                   R                  5       $ )zh
Return the font size as an integer.

See Also
--------
.font_manager.FontProperties.get_size_in_points
)r   get_size_in_pointsrl   s    r9   get_fontsizeText.get_fontsizeV  s     ##6688r;   c                 6    U R                   R                  5       $ )zb
Return the font variant as a string.

See Also
--------
.font_manager.FontProperties.get_variant
)r   get_variantrl   s    r9   get_fontvariantText.get_fontvariant`       ##//11r;   c                 6    U R                   R                  5       $ )zl
Return the font weight as a string or a number.

See Also
--------
.font_manager.FontProperties.get_weight
)r   
get_weightrl   s    r9   get_fontweightText.get_fontweightj  r  r;   c                 6    U R                   R                  5       $ )zn
Return the font stretch as a string or a number.

See Also
--------
.font_manager.FontProperties.get_stretch
)r   get_stretchrl   s    r9   r  Text.get_stretcht  r  r;   c                     U R                   $ )z[
Return the horizontal alignment as a string.  Will be one of
'left', 'center' or 'right'.
)r   rl   s    r9   rj  Text.get_horizontalalignment~  s    
 (((r;   c                     [        U R                  U R                  5      5      n[        U R                  U R                  5      5      nX4$ )z0Return the (x, y) unitless position of the text.)r=  r>  ri   r?  rj   r   s      r9   r   Text.get_unitless_position  s=     $%%dgg./$%%dgg./tr;   c                 2    U R                   U R                  4$ )z'Return the (x, y) position of the text.)ri   rj   rl   s    r9   ri  Text.get_position  s     wwr;   c                     U R                   $ )zReturn the text string.)rk   rl   s    r9   r  Text.get_text  rc  r;   c                     U R                   $ )zx
Return the vertical alignment as a string.  Will be one of
'top', 'center', 'bottom', 'baseline' or 'center_baseline'.
)r   rl   s    r9   get_verticalalignmentText.get_verticalalignment  s    
 &&&r;   c                    U R                  5       (       d  [        R                  " 5       $ U R                  SS9nUc  UR                  nU R                  5       S:X  aH  [        R                  " X2S9   U R                  5       u  pE[        R                  " XESS5      sSSS5        $ Ub  Xl
        U R                  c  UR                  5       U l
        U R                  c  [        S5      e[        R                  " X2S9   U R                  U R                  5      u  pgnU R                  5       u  pU R                  5       R!                  X45      u  pUR#                  X5      nUsSSS5        $ ! , (       d  f       N= f! , (       d  f       g= f)a;  
Return the `.Bbox` 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.

Parameters
----------
renderer : Renderer, optional
    A renderer is needed to compute the bounding box.  If the artist
    has already been drawn, the renderer is cached; thus, it is only
    necessary to pass this argument when calling `get_window_extent`
    before the first draw.  In practice, it is usually easier to
    trigger a draw first, e.g. by calling
    `~.Figure.draw_without_rendering` or ``plt.show()``.

dpi : float, optional
    The dpi value for computing the bbox, defaults to
    ``self.get_figure(root=True).dpi`` (*not* the renderer dpi); should be set
    e.g. if to match regions with a figure saved with a custom dpi value.
Tr   Nr{   )rC   r   zoCannot get window extent of text w/o renderer. You likely want to call 'figure.draw_without_rendering()' first.)r   r   unitr  rC   r  r   _setattr_cmr   r  r   _get_rendererRuntimeErrorr   r   r   r   
translated)rm   r!   rC   figtxtyr   r  r  r+   r,   s              r9   r   Text.get_window_extent  sJ   , !!99;oo4o(;''C==?b ""30--/''15 10 %N>>! ..0DN>>!HI I s,"&"2"24>>"BD--/DA%%'111&9DA??1(D -, 10 -,s   1*E+<A%E<+
E9<
F
c                     U R                   c  U R                  [        XS95        O"U R                   R                  [        US95        U R	                  5         SU l        g)z
Set the background color of the text by updating the bbox.

Parameters
----------
color : :mpltype:`color`

See Also
--------
.set_bbox : To change the position of the bounding box
N)	facecolor	edgecolor)r  T)r   r   r   r   r5  r   rm   rV   s     r9   set_backgroundcolorText.set_backgroundcolor  sM     #MM$@A##D5$9:$$&
r;   c                     [         R                  " US5      (       d  [        R                  R	                  US9  Xl        SU l        g)zV
Set the foreground color of the text

Parameters
----------
color : :mpltype:`color`
auto)rV   TN)r   
_str_equalr   colors_check_color_liker   r   r  s     r9   r   Text.set_color  s8     v..JJ((u(5
r;   c                 L    [         R                  " / SQUS9  Xl        SU l        g)z
Set the horizontal alignment relative to the anchor point.

See also :doc:`/gallery/text_labels_and_annotations/text_alignment`.

Parameters
----------
align : {'left', 'center', 'right'}
r   r   rq   alignTN)r   r   r   r   rm   r  s     r9   r   Text.set_horizontalalignment  s"     	6eD$)!
r;   c                 L    [         R                  " / SQUS9  Xl        SU l        g)a,  
Set the text alignment for multiline texts.

The layout of the bounding box of all the lines is determined by the
horizontalalignment and verticalalignment properties. This property
controls the alignment of the text lines within that box.

Parameters
----------
align : {'left', 'right', 'center'}
r  r  TN)r   r   r   r   r  s     r9   set_multialignmentText.set_multialignment   s"     	6eD$
r;   c                 P    [         R                  " [        US9  Xl        SU l        g)z
Set the line spacing as a multiple of the font size.

The default line spacing is 1.2.

Parameters
----------
spacing : float (multiple of font size)
)spacingTN)r   check_isinstancer   r   r   )rm   r  s     r9   r   Text.set_linespacing  s!     	dG4#
r;   c                 H    U R                   R                  U5        SU l        g)ai  
Set the font family.  Can 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 corresponding rcParams.

If a `Text` instance is constructed with ``fontfamily=None``, then the
font is set to :rc:`font.family`, and the
same is done when `set_fontfamily()` is called on an existing
`Text` instance.

Parameters
----------
fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}

See Also
--------
.font_manager.FontProperties.set_family
TN)r   
set_familyr   rm   rY   s     r9   set_fontfamilyText.set_fontfamily  s    * 	''1
r;   c                 H    U R                   R                  U5        SU l        g)z
Set the font variant.

Parameters
----------
variant : {'normal', 'small-caps'}

See Also
--------
.font_manager.FontProperties.set_variant
TN)r   set_variantr   )rm   rQ   s     r9   set_fontvariantText.set_fontvariant6  s     	((1
r;   c                 H    U R                   R                  U5        SU l        g)z
Set the font style.

Parameters
----------
fontstyle : {'normal', 'italic', 'oblique'}

See Also
--------
.font_manager.FontProperties.set_style
TN)r   	set_styler   )rm   r\   s     r9   set_fontstyleText.set_fontstyleE  s     	&&y1
r;   c                 H    U R                   R                  U5        SU l        g)a1  
Set the font size.

Parameters
----------
fontsize : float or {'xx-small', 'x-small', 'small', 'medium', 'large', 'x-large', 'xx-large'}
    If a float, the fontsize in points. The string values denote sizes
    relative to the default font size.

See Also
--------
.font_manager.FontProperties.set_size
TN)r   set_sizer   )rm   rZ   s     r9   set_fontsizeText.set_fontsizeT  s     	%%h/
r;   c                 6    U R                   R                  5       $ )z
Return the font family name for math text rendered by Matplotlib.

The default value is :rc:`mathtext.fontset`.

See Also
--------
set_math_fontfamily
)r   get_math_fontfamilyrl   s    r9   r  Text.get_math_fontfamilyf  s     ##7799r;   c                 :    U R                   R                  U5        g)a  
Set the font family for math text rendered by Matplotlib.

This does only affect Matplotlib's own math renderer. It has no effect
when rendering with TeX (``usetex=True``).

Parameters
----------
fontfamily : str
    The name of the font family.

    Available font families are defined in the
    :ref:`default matplotlibrc file
    <customizing-with-matplotlibrc-files>`.

See Also
--------
get_math_fontfamily
N)r   set_math_fontfamily)rm   rX   s     r9   r  Text.set_math_fontfamilyr  s    ( 	00<r;   c                 H    U R                   R                  U5        SU l        g)a"  
Set the font weight.

Parameters
----------
weight : {a numeric value in range 0-1000, 'ultralight', 'light', 'normal', 'regular', 'book', 'medium', 'roman', 'semibold', 'demibold', 'demi', 'bold', 'heavy', 'extra bold', 'black'}

See Also
--------
.font_manager.FontProperties.set_weight
TN)r   
set_weightr   )rm   rR   s     r9   set_fontweightText.set_fontweight  s     	''/
r;   c                 H    U R                   R                  U5        SU l        g)aM  
Set the font stretch (horizontal condensation or expansion).

Parameters
----------
stretch : {a numeric value in range 0-1000, 'ultra-condensed', 'extra-condensed', 'condensed', 'semi-condensed', 'normal', 'semi-expanded', 'expanded', 'extra-expanded', 'ultra-expanded'}

See Also
--------
.font_manager.FontProperties.set_stretch
TN)r   set_stretchr   )rm   rO   s     r9   set_fontstretchText.set_fontstretch  s     	((1
r;   c                 T    U R                  US   5        U R                  US   5        g)zU
Set the (*x*, *y*) position of the text.

Parameters
----------
xy : (float, float)
r   r   N)set_xset_y)rm   xys     r9   set_positionText.set_position  s$     	

2a5

2a5r;   c                     Xl         SU l        g)zD
Set the *x* position of the text.

Parameters
----------
x : float
TN)ri   r   )rm   r+   s     r9   r   
Text.set_x       
r;   c                     Xl         SU l        g)zD
Set the *y* position of the text.

Parameters
----------
y : float
TN)rj   r   )rm   r,   s     r9   r!  
Text.set_y  r'  r;   c                    [        U[        5      (       a  [        U5      S-  U l        OY[        R
                  " US5      (       d  Uc  SU l        O2[        R
                  " US5      (       a  SU l        O[        SU 35      eSU l        g)	z
Set the rotation of the text.

Parameters
----------
s : float or {'vertical', 'horizontal'}
    The rotation angle in degrees in mathematically positive direction
    (counterclockwise). 'horizontal' equals 0, 'vertical' equals 90.
rh  
horizontalNr   verticalg     V@z;rotation must be 'vertical', 'horizontal' or a number, not T)r4  r   r=  r   r   r  
ValueErrorr   rm   ss     r9   r   Text.set_rotation  s{     a"1X^DNa..!)DNa,, DN ../S2 3 3
r;   c                     Xl         SU l        g)z_
Whether rotations of the transform affect the text direction.

Parameters
----------
t : bool
TN)r   r   )rm   r)   s     r9   set_transform_rotates_textText.set_transform_rotates_text  s     ()$
r;   c                 L    [         R                  " / SQUS9  Xl        SU l        g)z
Set the vertical alignment relative to the anchor point.

See also :doc:`/gallery/text_labels_and_annotations/text_alignment`.

Parameters
----------
align : {'baseline', 'bottom', 'center', 'center_baseline', 'top'}
)r   bottomr   rp   r   r  TN)r   r   r   r   r  s     r9   r   Text.set_verticalalignment  s'     	F	 #(
r;   c                 ^    Uc  SO
[        U5      nXR                  :w  a  Xl        SU l        gg)z
Set the text string *s*.

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

Parameters
----------
s : object
    Any object gets converted to its `str` representation, except for
    ``None`` which is converted to an empty string.
Nr{   T)r   rk   r   r.  s     r9   r   Text.set_text  s-     )BQ

?JDJ r;   c                     U R                  5       (       a  US:X  a  SnUS4$ U R                  5       (       d  US4$ [        R                  " U5      (       a  US4$ UR	                  SS5      S4$ )a  
Return the string *s* after mathtext preprocessing, and the kind of
mathtext support needed.

- If *self* is configured to use TeX, return *s* unchanged except that
  a single space gets escaped, and the flag "TeX".
- Otherwise, if *s* is mathtext (has an even number of unescaped dollar
  signs) and ``parse_math`` is not set to False, return *s* and the
  flag True.
- Otherwise, return *s* with dollar signs unescaped, and the flag
  False.
r  z\ r   FTz\$$)r   get_parse_mathr   r|  replacer.  s     r9   r  Text._preprocess_math  sn     ??Cxe8O$$&&e8O""d7N99UC(%//r;   c                 d    [         R                  " U5      R                  5       U l        SU l        g)a2  
Set the font properties that control the text.

Parameters
----------
fp : `.font_manager.FontProperties` or `str` or `pathlib.Path`
    If a `str`, it is interpreted as a fontconfig pattern parsed by
    `.FontProperties`.  If a `pathlib.Path`, it is interpreted as the
    absolute path to a font file.
TN)r
   	_from_anyr@   r   r   )rm   fps     r9   r   Text.set_fontproperties$  s'      .77;@@B
r;   z bool, default: :rc:`text.usetex`c                 j    Uc  [         R                  S   U l        O[        U5      U l        SU l        g)z{
Parameters
----------
usetex : bool or None
    Whether to render using TeX, ``None`` means to use
    :rc:`text.usetex`.
Nztext.usetexT)r   r   r   boolr   )rm   ru   s     r9   r   Text.set_usetex2  s+     ><<6DL<DL
r;   c                     U R                   $ )z9Return whether this `Text` object uses TeX for rendering.)r   rl   s    r9   r   Text.get_usetexA  s    ||r;   c                 $    [        U5      U l        g)z
Override switch to disable any mathtext parsing for this `Text`.

Parameters
----------
parse_math : bool
    If False, this `Text` will never use mathtext.  If True, mathtext
    will be used if there is an even number of unescaped dollar signs.
N)rC  _parse_math)rm   rx   s     r9   r   Text.set_parse_mathE  s      
+r;   c                     U R                   $ )z>Return whether mathtext parsing is considered for this `Text`.)rH  rl   s    r9   r;  Text.get_parse_mathQ  s    r;   c                 &    U R                  U5        g)z
Alias for `set_fontfamily`.

One-way alias only: the getter differs.

Parameters
----------
fontname : {FONTNAME, 'serif', 'sans-serif', 'cursive', 'fantasy', 'monospace'}

See Also
--------
.font_manager.FontProperties.set_family

N)r  r  s     r9   set_fontnameText.set_fontnameU  s      	H%r;   )r   r   r   r   r   r   r   rH  r   r   r   r   rk   r   r   r   r`  ri   rj   r   )r   r   r{   )r{   NNNNFrp   rq   NNFNNNrF   NN)W__name__
__module____qualname____firstlineno____doc__zorderr   r   rn   r}   r~   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r:  rH  r5  rT  rW  r[  ra  r   ro  rk  r~  r   r   allow_rasterizationr  r  r{  r  r  r  r  r  r  r  rj  r   ri  r  r  r   r  r   r   r  r   r  r  r  r  r  r  r  r  r#  r   r!  r   r2  r   r   r  r   r   	kwarg_docr   r   r   r;  rM  __static_attributes____classcell__r   s   @r9   rc   rc   P   s&     LFfO= !#3#-%+ $ $!#(- !3 3n $"$#?J .6-5@",&#"! VDp&'P C./'
'
'
*4.	1(f K  KZ$1/09212) '/b( 0$
:=,""			*	 "00 <= >
, & &r;   rc   c                   4    \ rS rSrSrS	S jrS rS rS rSr	g)

OffsetFromih  z4Callable helper class for working with `Annotation`.c                 J    Xl         Uu  pEXE4U l        U R                  U5        g)a  
Parameters
----------
artist : `~matplotlib.artist.Artist` or `.BboxBase` or `.Transform`
    The object to compute the offset from.

ref_coord : (float, float)
    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'}, default: 'points'
    The screen units to use (pixels or points) for the offset input.
N)_artist
_ref_coordset_unit)rm   r   	ref_coordr  r+   r,   s         r9   r}   OffsetFrom.__init__k  s%    $ $dr;   c                 >    [         R                  " SS/US9  Xl        g)zr
Set the unit for input to the transform used by ``__call__``.

Parameters
----------
unit : {'points', 'pixels'}
pointspixels)r  N)r   r   _unit)rm   r  s     r9   r`  OffsetFrom.set_unit  s     	Hh/d;
r;   c                     U R                   $ )z@Return the unit for input to the transform used by ``__call__``.)rf  rl   s    r9   get_unitOffsetFrom.get_unit  rc  r;   c                 j   [        U R                  [        5      (       ab  U R                  R                  U5      nU R                  u  p4UR
                  UR                  U-  -   nUR                  UR                  U-  -   nO[        U R                  [        5      (       aS  U R                  nU R                  u  p4UR
                  UR                  U-  -   nUR                  UR                  U-  -   nOu[        U R                  [        5      (       a(  U R                  R                  U R                  5      u  pVO.[        R                  " [        [        [        4U R                  S9  U R                  S:X  a  SOUR                  S5      n[!        5       R#                  U5      R%                  WW5      $ )z
Return the offset transform.

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

Returns
-------
`Transform`
    Maps (x, y) in pixel or point units to screen units
    relative to the given artist.
)r   re  r   )r4  r^  r	   r   r_  r   r  r   r"  r   r   r   r   r  rf  rC  r   scalerB  )rm   r!   r   xfyfr+   r,   rl  s           r9   __call__OffsetFrom.__call__  s8    dllF++<<11(;D__FB$**r/)A$++**Ah//<<D__FB$**r/)A$++**Ai00<<))$//:DAq!!68Y"?UZZ8+1J1J11Mz&00A66r;   )r^  r_  rf  N)rd  )
rP  rQ  rR  rS  rT  r}   r`  ri  ro  rX   r;   r9   r\  r\  h  s    >.	7r;   r\  c                   T    \ rS rSr  SS jrS rS rS rS rS r	SS	 jr
SS
 jrSrg)_AnnotationBasei  Nc                 X    Uu  pEXE4U l         X l        U R                  U5        S U l        g rF   )r"  xycoordsset_annotation_clip
_draggable)rm   r"  ru  annotation_clipr+   r,   s         r9   r}   _AnnotationBase.__init__  s.    
 $   1r;   c                    Uu  pE[        U[        5      (       a  UOX34u  pgUS:X  a  [        U R                  U5      5      nUS:X  a  [        U R	                  U5      5      nU R                  X5      R                  XE45      $ )Ndata)r4  tupler=  r>  r?  _get_xy_transformr   )rm   r!   r"  coordsr+   r,   xcoordycoords           r9   _get_xy_AnnotationBase._get_xy  sy    #-fe#<#<6BRVd))!,-AVd))!,-A%%h7AA1&IIr;   c                    [        U[        5      (       a4  Uu  p4SSKJn  U R	                  X5      nU R	                  X5      nU" Xg5      $ [        U5      (       a`  U" U5      n[        U[        5      (       a  [        U5      $ [        U[        5      (       a  U$ [        S[        U5      R                   35      e[        U[        5      (       a  UR                  U5      n	[        U	5      $ [        U[        5      (       a  [        U5      $ [        U[        5      (       a  U$ [        U[        5      (       d!  [        S[        U5      R                   35      eUS:X  a  U R                  R                   $ US:X  a/  SSKJn
  U
R'                  SS	9nXR                  R                   -   nU$  UR)                  5       u  pSu  pUS:X  a  U R-                  SS9R.                  nO<US:X  a  U R-                  SS9R0                  nOUS:X  a  U R                  R0                  nUb  UR2                  nO'US:X  a  U R5                  U5      nO[+        U< S
35      eUS:X  a4  [7        5       R9                  U R-                  SS9R:                  S-  5      nOUS:X  a  [7        5       nOUS:X  aE  [7        5       R9                  U R=                  5       U R-                  SS9R:                  -  S-  5      nO7US:X  a"  [7        5       R8                  " UR>                  6 nO[+        U< S35      eUR@                  " U6 $ ! [*         a    [+        U< S
35      S ef = f)Nr   )blended_transform_factoryz=xycoords callable must return a BboxBase or Transform, not a z^'xycoords' must be an instance of str, tuple[str, str], Artist, Transform, or Callable, not a r{  polar)	PolarAxesF)apply_theta_transformsz is not a valid coordinaterO  figurer   	subfigureaxesoffsetrd  TH   re  rZ   fractionz is not a recognized unit)!r4  r|  matplotlib.transformsr  r}  callabler   r   r   	TypeErrortyperP  r	   r   r   r  	transDatamatplotlib.projectionsr  PolarTransformr   r-  r  figbboxr   p0_get_position_xyr   rl  rC   r3  rN   rB  )rm   r!   r~  r  r  r  tr1tr2r%   r   r  r  	bbox_namer  bbox0xy0s                   r9   r}  !_AnnotationBase._get_xy_transform  s   fe$$#NFG((:C((:C,S66f!B"h''&r**B	**	SBx(()+, , ''++H5D"4(())"6**	**MFC((115f1F1F0GIJ J V99&&&w8)))GB,,,EL	P$llnOI  
  OOO/77E+%OOO/44E& IINNE ((C("''1Cz)CDEE8!!T*..35BXBZ!!$//t/"<"@"@@2EGBZ!!5::.Bx'@ABB||S!!E  	Pz)CDE4O	Ps   *L/ /M
c                     Xl         g)aQ  
Set the annotation's clipping behavior.

Parameters
----------
b : bool or None
    - True: The annotation will be clipped when ``self.xy`` is
      outside the Axes.
    - False: The annotation will always be drawn.
    - None: The annotation will be clipped when ``self.xy`` is
      outside the Axes and ``self.xycoords == "data"``.
N_annotation_clip)rm   r\  s     r9   rv  #_AnnotationBase.set_annotation_clip  s
     !"r;   c                     U R                   $ )zi
Return the annotation's clipping behavior.

See `set_annotation_clip` for the meaning of return values.
r  rl   s    r9   get_annotation_clip#_AnnotationBase.get_annotation_clip#  s     $$$r;   c                 N    U R                  XR                  U R                  5      $ )z1Return the pixel position of the annotated point.)r  r"  ru  )rm   r!   s     r9   r   _AnnotationBase._get_position_xy+  s    ||Hggt}}==r;   c                     Uc  U R                  SS9R                  5       nU R                  5       nU(       d  Uc<  U R                  S:X  a,  U R	                  U5      nU R
                  R                  U5      $ g)z;Check whether the annotation at *xy_pixel* should be drawn.Tr   r{  )r  r  r  ru  r  r  contains_point)rm   r!   r\  xy_pixels       r9   	_check_xy_AnnotationBase._check_xy/  si    D1??AH$$&t}}6,,X6H99++H55r;   c                    SSK Jn  U R                  SLnUc  U(       + nU(       a&  U R                  c  U" X5      U l        U R                  $ U R                  b  U R                  R                  5         SU l        U R                  $ )a  
Set whether the annotation is draggable with the mouse.

Parameters
----------
state : bool or None
    - True or False: set the draggability.
    - None: toggle the draggability.
use_blit : bool, default: False
    Use blitting for faster image composition. For details see
    :ref:`func-animation`.

Returns
-------
DraggableAnnotation or None
    If the annotation is draggable, the corresponding
    `.DraggableAnnotation` helper is returned.
r   )DraggableAnnotationN)matplotlib.offsetboxr  rw  
disconnect)rm   stateuse_blitr  is_draggables        r9   	draggable_AnnotationBase.draggable:  sv    & 	=d2 =$$E&"5d"E 	 ***,"DOr;   )r  rw  r"  ru  )r{  NrF   NF)rP  rQ  rR  rS  r}   r  r}  rv  r  r  r  r  rX  rq  r;   r9   rs  rs    s5     !!%
JJ"X"%>	"r;   rs  c                     ^  \ rS rSrSrS r     SS jrS r\S 5       r	\	R                  S 5       r	\S 5       r\R                  S	 5       rS
 rS r\" \\SS9rS rS r\R$                  S 5       rSS jrSU 4S jjrSrU =r$ )
Annotationi_  a4  
An `.Annotation` is a `.Text` that can refer to a specific position *xy*.
Optionally an arrow pointing from the text to *xy* can be drawn.

Attributes
----------
xy
    The annotated position.
xycoords
    The coordinate system for *xy*.
arrow_patch
    A `.FancyArrowPatch` to point from *xytext* to *xy*.
c                 h    SU R                   S   S SU R                   S   S SU R                  < S3$ )NzAnnotation(r   grg   r   rh   )r"  rk   rl   s    r9   __str__Annotation.__str__n  s5    TWWQZN"TWWQZN"TZZN!LLr;   c                    [         R                  U UUUS9  Uc  Ub  XT:w  a  [        R                  " S5        Uc  U R                  nXPl        Uc  U R                  nUu  pX`l        UbZ  UR                  5       nSU;   a  UR                  SS5      U l
        OS H  nUR                  US5        M     [        S0 UD6U l        OSU l        [        R                  " X	X40 UD6  g)	a  
Annotate the point *xy* with text *text*.

In the simplest form, the text is placed at *xy*.

Optionally, the text can be displayed in another position *xytext*.
An arrow pointing from the text to the annotated point *xy* can then
be added by defining *arrowprops*.

Parameters
----------
text : str
    The text of the annotation.

xy : (float, float)
    The point *(x, y)* to annotate. The coordinate system is determined
    by *xycoords*.

xytext : (float, float), default: *xy*
    The position *(x, y)* to place the text at. The coordinate system
    is determined by *textcoords*.

xycoords : single or two-tuple of str or `.Artist` or `.Transform` or callable, default: 'data'

    The coordinate system that *xy* is given in. The following types
    of values are supported:

    - One of the following strings:

      ==================== ============================================
      Value                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
      'subfigure points'   Points from the lower left of the subfigure
      'subfigure pixels'   Pixels from the lower left of the subfigure
      'subfigure fraction' Fraction of subfigure from lower left
      'axes points'        Points from lower left corner of the Axes
      'axes pixels'        Pixels from lower left corner of the 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
      ==================== ============================================

      Note that 'subfigure pixels' and 'figure pixels' are the same
      for the parent figure, so users who want code that is usable in
      a subfigure can use 'subfigure pixels'.

    - An `.Artist`: *xy* is interpreted as a fraction of the artist's
      `~matplotlib.transforms.Bbox`. E.g. *(0, 0)* would be the lower
      left corner of the bounding box and *(0.5, 1)* would be the
      center top of the bounding box.

    - A `.Transform` to transform *xy* to screen coordinates.

    - A function with one of the following signatures::

        def transform(renderer) -> Bbox
        def transform(renderer) -> Transform

      where *renderer* is a `.RendererBase` subclass.

      The result of the function is interpreted like the `.Artist` and
      `.Transform` cases above.

    - A tuple *(xcoords, ycoords)* specifying separate coordinate
      systems for *x* and *y*. *xcoords* and *ycoords* must each be
      of one of the above described types.

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

textcoords : single or two-tuple of str or `.Artist` or `.Transform` or callable, default: value of *xycoords*
    The coordinate system that *xytext* is given in.

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

    =================   =================================================
    Value               Description
    =================   =================================================
    'offset points'     Offset, in points, from the *xy* value
    'offset pixels'     Offset, in pixels, from the *xy* value
    'offset fontsize'   Offset, relative to fontsize, from the *xy* value
    =================   =================================================

arrowprops : dict, optional
    The properties used to draw a `.FancyArrowPatch` arrow between the
    positions *xy* and *xytext*.  Defaults to None, i.e. no arrow is
    drawn.

    For historical reasons there are two different ways to specify
    arrows, "simple" and "fancy":

    **Simple arrow:**

    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 `.FancyArrowPatch` property
    ==========  =================================================

    The arrow is attached to the edge of the text box, the exact
    position (corners or centers) depending on where it's pointing to.

    **Fancy arrow:**

    This is used if 'arrowstyle' is provided in the *arrowprops*.

    Valid keys are the following `.FancyArrowPatch` parameters:

    ===============  ===================================
    Key              Description
    ===============  ===================================
    arrowstyle       The arrow style
    connectionstyle  The connection style
    relpos           See below; default is (0.5, 0.5)
    patchA           Default is bounding box of the text
    patchB           Default is None
    shrinkA          In points. Default is 2 points
    shrinkB          In points. Default is 2 points
    mutation_scale   Default is text size (in points)
    mutation_aspect  Default is 1
    ?                Any `.FancyArrowPatch` property
    ===============  ===================================

    The exact starting point position of the arrow is defined by
    *relpos*. It's a tuple of relative coordinates of the text box,
    where (0, 0) is the lower left corner and (1, 1) is the upper
    right corner. Values <0 and >1 are supported and specify points
    outside the text box. By default (0.5, 0.5), so the starting point
    is centered in the text box.

annotation_clip : bool or None, default: None
    Whether to clip (i.e. not draw) the annotation when the annotation
    point *xy* is outside the Axes area.

    - If *True*, the annotation will be clipped when *xy* is outside
      the Axes.
    - If *False*, the annotation will always be drawn.
    - If *None*, the annotation will be clipped when *xy* is outside
      the Axes and *xycoords* is 'data'.

**kwargs
    Additional kwargs are passed to `.Text`.

Returns
-------
`.Annotation`

See Also
--------
:ref:`annotations`

)ru  rx  NzgYou have used the `textcoords` kwarg, but not the `xytext` kwarg.  This can lead to surprising results.
arrowstylerelpos)      ?r  )r  	headwidth
headlengthshrink)r2  )r   r   )rs  r}   r   warn_externalru  _textcoordsr"  
arrowpropsr@   r   _arrow_relposr   arrow_patchrc   )rm   r    r"  xytextru  
textcoordsr  rx  r   r+   r,   keys               r9   r}   Annotation.__init__q  s    X 	  !#*21@ 	! 	B
 N&&  5 6
 J% >WWF$!#*Jz)%/^^Hj%I" JCNN3- J.LLD#D 	dq1&1r;   c                     U R                  U5      (       a  S0 4$ [        R                  X5      u  p#U R                  b(  U R                  R                  U5      u  pEU=(       d    UnX#4$ r  )r   rc   r   r  )rm   r   r   tinfoin_patchr&   s         r9   r   Annotation.containsC  sc    !!*--"9--9'**33J?KH+8Hr;   c                     U R                   $ rF   )	_xycoordsrl   s    r9   ru  Annotation.xycoordsL  s    ~~r;   c                     S n[        U[        5      (       a  [        [        X!5      5      (       d  U" U5      (       a  [	        S5      eXl        g )Nc                 R    [        U [        5      =(       a    U R                  S5      $ )Nr  )r4  r   
startswith)r/  s    r9   	is_offset&Annotation.xycoords.<locals>.is_offsetR  s    a%@!,,x*@@r;   z'xycoords cannot be an offset coordinate)r4  r|  anymapr-  r  )rm   ru  r  s      r9   ru  r  P  sB    	A x''CI0H,I,IX&&FGG!r;   c                 "    U R                  5       $ )z9
The text position.

See also *xytext* in `.Annotation`.
)ri  rl   s    r9   xyannAnnotation.xyannZ  s       ""r;   c                 &    U R                  U5        g rF   )r#  )rm   r  s     r9   r  r  c  s    &!r;   c                     U R                   $ )ze
Return the coordinate system to use for `.Annotation.xyann`.

See also *xycoords* in `.Annotation`.
r  rl   s    r9   get_anncoordsAnnotation.get_anncoordsg  s     r;   c                     Xl         g)zb
Set the coordinate system to use for `.Annotation.xyann`.

See also *xycoords* in `.Annotation`.
Nr  )rm   r~  s     r9   set_anncoordsAnnotation.set_anncoordso  s
     "r;   z>
        The coordinate system to use for `.Annotation.xyann`.)docc                     U R                   b  U R                   R                  U5        [        R                  " X5        g rF   )r  
set_figurer	   )rm   r  s     r9   r  Annotation.set_figurez  s0    ''',$$r;   c                 $  ^^ U R                  U R                  XR                  5      5        U R                  nUc  g[        R                  X5      nU R                  U5      =nu  mmUR                  SU R                  5       5      nU R                  R                  U5        SU;  Gag  UR                  SS5      nUR                  SS5      nUR                  SS	5      nUR                  S
S	5      n	[        X-  X-  Xu-  S9n
U R                  R                  " S0 U
D6  UR                  S4UR                  UR                  -   S-  S4UR                  S4/nUR                  S4UR                  UR                   -   S-  S4UR                   S4/n[#        UU4S jS9u  p[#        UU4S jS9u  nnUU4U l        [&        R(                  " UT-
  UT-
  5      nUU-  UR+                  S5      -  nU=U R                  l        U R                  l        UR0                  UR2                  U R$                  -  -   nU R                  R5                  UU5        SU;   a  US   nOU R6                  (       a  U R6                  nOyU R9                  5       S:X  a  SnObUR+                  S5      n[;        UR                  US-  -
  UR                  US-  -
  4UR<                  U-   UR>                  U-   [A        5       SS9nU R                  RC                  U5        g)zH
Update the pixel positions of the annotation text and the arrow patch.
Nmutation_scaler  r  r   r  r1  r     r  )head_length
head_width
tail_widthr   r   r  r   c                 &   > [        U S   T-
  5      $ Nr   r   )vr   s    r9   <lambda>-Annotation.update_positions.<locals>.<lambda>      QqTBYr;   )r  c                 &   > [        U S   T-
  5      $ r  r  )r  r   s    r9   r  r    r  r;   patchAr{   F)r"  r  r"  r   rM  )simple)"rA  r}  	anncoordsr  rc   r   r  getr3  r  rD  r   set_arrowstyler   r   r   r   r   r  r   hypotrC  shrinkAshrinkBr  rN   set_positionsr   r  r   r  r"  r   
set_patchA)rm   r!   r  r   	arrow_endmsr  r  r  r  stylekwxposyposr+   relposxr,   relposyr
shrink_ptsarrow_beginr  r/  r   r   s                         @@r9   update_positionsAnnotation.update_positions  s   
 	411(NNKL__
%%d5!228<<	FB^^,dmmo>++B/z)^^Hc2FNN7A.E"{B7I#b9J z&/n&+j2G ++@@ WWaLDGGdgg$5#:C"@477A,ODWWaLDGGdgg$5#:C"@477A,ODT'?@JAT'?@JAw")7!3DRR(A!h&?&?&BBJBLLD$t'7'7'? gg		D,>,> >> 	&&{I>z!)F%%F]]_"F++A.CGGcAg%twwq'89jj3&t{{S/@+-u>F 	##F+r;   c                    Ub  Xl         U R                  5       (       a  U R                  U5      (       d  g U R                  U5        U R	                  U5        U R
                  bb  U R
                  R                  SS9c-  U R                  SS9=nb  U R
                  R                  U5        U R
                  R                  U5        [        R                  X5        g )NFr   )
r   r   r  r  rH  r  r  r  r  rc   )rm   r!   r  s      r9   r  Annotation.draw  s     %N!!)A)A 	h'&&x0'  +++7? OOO77SD  ++C0!!(+ 			$!r;   c                     U R                  5       (       a  U R                  U5      (       d  [        R                  " 5       $ Ub  Xl        U R                  c"  U R                  SS9R                  5       U l        U R                  c  [        S5      eU R                  U R                  5        [        R                  U 5      nU/nU R                  b)  UR                  U R                  R                  5       5        [        R                  " U5      $ )NTr   z)Cannot get window extent without renderer)r   r  r   r  r   r  r  r  r  rc   r   r  r   union)rm   r!   	text_bboxbboxess       r9   r   Annotation.get_window_extent  s     !!)A)A99;%N>>!!__$_7EEGDN>>!JKKdnn-**40	'MM$**<<>?zz&!!r;   c                 x   > U R                  U5      (       d  [        R                  " 5       $ [        TU ]  U5      $ rF   )r  r   nullr|   get_tightbbox)rm   r!   r   s     r9   r  Annotation.get_tightbbox  s.    ~~h''99;w$X..r;   )r  r   r  r  r  r  )Nr{  NNNrF   )rP  rQ  rR  rS  rT  r  r}   r   propertyru  setterr  r  r  r  r  r  r   rV  r  r   r  rX  rY  rZ  s   @r9   r  r  _  s    M    !%P2d   __" " # # \\" " "  <A BI%?,B "  "&"./ /r;   r  )r  )0rT  	functoolsloggingrs  numbersr   r>   numpyr   
matplotlibr   r{   r   r   r   r   r	   font_managerr
   patchesr   r   r   textpathr   r   
transformsr   r   r   r   r   r   	getLoggerrP  r  r:   rD   	lru_cacher=   interpddefine_aliasesrc   r\  rs  r  registerr}   rq  r;   r9   <module>r(     sN          - -  ( ? ? *M M "$&NC TP P U01*;;* 6f F&6 F& F&R(G7 G7Tj jZQ/ Q/h     z':':'B'B  Cr;   