+
     ]iA  c                   s   ^ RI Ht ^ RIt^ RIt^ RIHt ^ RIt^ RIH	t	H
t
 ^ RIHt ^ RIHt ^ RIHt ^ RIHtHt ^ RIHtHtHtHtHtHtHtHtH t H!t!H"t" ]
! R.RR	7      R
 4       t#R t$R t%R t&]PN                  PQ                  R^.. R5OR.RR.34      ]PN                  PQ                  RR64      ]PN                  PQ                  RR74      ]PN                  PQ                  RR84      R 4       4       4       4       t)]! RR4      t*]PN                  PQ                  R]*! . R9OR^^. R:O3R7      ]*! . R9O^
^^
. R:O3R7      ]*! . R9O^^^. R:O3R7      .4      R 4       t+]PN                  PQ                  R]*! . R;ORR^. R<O3R7      ]*! . R9O^
^^
. R=O3R7      ]*! . R9O^^^. R>O3R7      .4      R 4       t,]PN                  PQ                  R]*! . R?O^R^. R@O3R7      ]*! . RAO^R^. RBO3R7      ]*! . RCOR^^. R@O3R7      .4      R 4       t-R t.]PN                  PQ                  R. RDO4      ]PN                  PQ                  R. REO4      R 4       4       t/]
! R.RR R!7      R" 4       t0]PN                  PQ                  R#R$R%.4      R& 4       t1R' t2R( t3]PN                  PQ                  R). RFO4      R* 4       t4R+ t5R, t6R- t7]	! R..R/7      R0 4       t8]
! R1.RR R!7      R2 4       t9R3 t:R4 t;R# )G    )
namedtupleN)assert_allclose)check_figures_equalimage_comparison)MouseButton
MouseEvent)AnchoredOffsetboxAnnotationBboxAnchoredTextDrawingAreaHPacker	OffsetBoxOffsetImage	PaddedBoxTextAreaVPacker_get_packed_offsetsZoffsetbox_clippingT)remove_textc            
      s   \         P                  ! 4       w  r^dp\        W"RR7      p\        P                  ! RW"RR^ R7      p\
        P                  ! V) R,          VR,          .V^,          V^,          .R^
R	7      p\        R
VRRRVP                  RR7      pVP                  V4       VP                  V4       VP                  V4       VP                  R4       VP                  R4       R# )d   TZclip#CCCCCCNone	facecolorZ	edgecolor	linewidth      ?      ?blackZcolorr   center        FlocchildpadZframeonZbbox_to_anchorZbbox_transformZ	borderpadNr    r    r   r   )r       )pltsubplotsr
   mpatches	RectanglemlinesLine2Dr   	transAxes
add_artistset_xlimset_ylimfigaxZsizedaZbgZlineanchored_box          F/usr/lib64/python3.14/site-packages/matplotlib/tests/test_offsetbox.pytest_offsetbox_clippingr8      s     llnGCD	Td	+B			FD&/&,&'
)B ==4%(DH-QQ/?&#%'D %||L MM"MM$MM,KKKK    c            
      s   \         P                  ! 4       w  r^dp\        W"RR7      p\        P                  ! RW"RR^ R7      p\
        P                  ! V) R,          VR,          .V^,          V^,          .R^
R	7      p\        R
VRRRVP                  RR7      pVP                  V4       VP                  V4       VP                  V4       V P                  P                  4        RVn        R# )r   Tr   r   r   r   r   r   r   r   r   r   Fr    Nr$   r%   )r'   r(   r
   r)   r*   r+   r,   r   r-   r.   canvasdrawZclip_childrenr1   r6   r7   test_offsetbox_clip_childrenr<   7   s     llnGCD	Td	+B			FD&/&,&'
)B ==4%(DH-QQ/?&#%'D %||L MM"MM$MM,JJOOBr9   c                  s    R ^R^R^R^R^R^R^R^R^	R	^
/
p \         P                  ! 4       w  r\        ^d^d4      pV  F   p\        WCR
7      pVP	                  V4       K"  	  VP
                  P                  4        R# )upper right
upper leftz
lower leftlower rightrightcenter leftcenter rightzlower centerzupper centerr   )r!   r"   N)r'   r(   r
   r   r.   r:   r;   )Zcodesr2   r3   r4   Zcoder5   s         r7   test_offsetbox_loc_codesrC   \   s    A11AaAQQQr
E llnGC	S#	B(T<
l#  JJOOr9   c                  s    \         P                  ! 4       w  r^^.p^^.pVP                  VRR7       VP                  VRR7       VP                  ^RR7       V P	                  4        R# )r&   zseries 1)Zlabelzseries 2expand)ZncolsmodeN)r'   r(   ZplotZlegendtight_layout)r2   r3   Zd1Zd2       r7   test_expand_with_tight_layoutrH   q   s]    llnGC
QB
QBGGBjG!GGBjG!IIAHI%r9   widths皙?totalseprE   c                 s     \        WW#R 7       R# )rE   N)r   )rI   rK   rL   rE   s   &&&&r7   test_get_packed_offsetsrN   ~   s     s6r9   _Paramszwd_list, total, sep, expectedzwidths, total, sep, expected)rK   rL   expectedc                 V    \        WVR R7      p\        V^,          V^,          4       R# )fixedrM   Nr   r   rI   rK   rL   rP   Zresult   &&&& r7   test_get_packed_offsets_fixedrV      s$     !'BFF1Ix{+r9   c                 rQ   )rD   rM   NrS   rT   rU   r7   test_get_packed_offsets_expandrW      s$     !(CFF1Ix{+r9   c                 rQ   )equalrM   NrS   rT   rU   r7   test_get_packed_offsets_equalrY      s$     !'BFF1Ix{+r9   c            	      s    \         P                  ! \        4      ;_uu_ 4        \        . RORRRR7       RRR4       R#   + '       g   i     R# ; i)r&   NrX   )rK   rL   rE   )r&   r&   r&   )pytestZraisesZ
ValueErrorr    r9   r7   1test_get_packed_offsets_equal_total_none_sep_noner\      s.    	z	"	"ITt'J 
#	"	"	"s	   ?A	
child_type	boxcoordsc           	      s  a	 V R 8X  d7   \        ^^4      pVP                  \        P                  ! R^^^ R7      4       MDV R8X  d(   \        P
                  ! R4      p^ VR&   \        V4      pMV R8X  d   \        RR^/R7      p\        P                  ! 4       w  rE\        XRVR7      pVP                  R	4       VP                  V4       . o	VP                  P                  R
V	3R l4       VR8X  da   VP                  P                  R4      w  rxVRVP                   ,          ^H,          ,          pVRVP                   ,          ^H,          ,          pMTVR8X  d1   VP                  P                  R4      w  rxVR,          pVR,          pMVP                  P                  R4      w  rxVP                  P#                  4        S	P%                  4        \'        RVP                  Wx\(        P*                  4      P-                  4        VP/                  R^ 4       VP1                  R^ 4       VP                  P#                  4        S	P%                  4        \'        RVP                  Wx\(        P*                  4      P-                  4        R# )r;   )r   imagetextu   ■Zfontsize)Z	textpropsr   )r^   TZ
pick_eventc                 s&   < SP                  V 4      # N)Zappend)Zeventcallss   &r7   Z<lambda>Ztest_picking.<locals>.<lambda>   s    u||E7Jr9   axes pointsaxes pixelsbutton_press_eventNr$   )   rf   )   rg   r%   )r
   r.   r)   r*   npZonesr   r   r'   r(   r   Z
set_pickerr:   Zmpl_connectr-   Ztransform_pointdpir;   Zclearr   r   ZLEFT_processr/   r0   )
r]   r^   Zpicking_childimr2   r3   abZxZyrb   s
   &&       @r7   test_pickingrn      s    V#Aq)  !3!3FAqA!NO	w	WWV_4#B	v	 !3
AO llnGC	zY	GBMM$MM"EJJ<)JK M!||++F3	S377]R	S377]R	m	#||++F3	S	S||++J7JJOO	KKMcjj!0@0@BBJ(*
 KKAKKAJJOO	KKMcjj!0@0@BBJ(*r9   zanchoredtext_align.pngZmpl20)r   Zstylec                  s    \         P                  ! 4       w  r\        R RRRR/R7      pVP                  V4       \        R RRRR/R7      pVP                  V4       \        R RRRR/R7      pVP                  V4       R	# )
ztest
test long textrA   皙?haleft)r!   r#   Zpropr   rB   r@   N)r'   r(   r	   r.   )r2   r3   text0text1Ztext2        r7   &test_anchoredtext_horizontal_alignmentru      s|    llnGC/] f~7EMM%/X h'79EMM%/^ g8EMM%r9   extent_kindZwindow_extentZ	tightbboxc                 s   \         P                  P                  \         P                  4       \         P                  ! R^dR7      w  rVP                  . RO4       VP                  RRR\        RR7      RRRR7      p\        ^^^ ^ R	R
7      p\        P                  ! R^ 4      pVP                  V4       \        VRR.RRRR\        RR7      R7      pVP                  V4       \        \        P                  P!                  ^
^
4      ^R7      pW'P"                  n        \        VRR RRR\        RR7      R7      pVP                  V4       \'        VRV  24      ! 4       p	. R!Op
\)        V	P*                  V
^R7       \'        VRV  24      ! 4       p. R"Op\)        VP*                  V^R7       \'        VRV  24      ! 4       p. R#Op\)        VP*                  V^R7       \,        P.                  ! 4       pVP1                  VRR7       VP3                  ^ 4       \         P4                  ! V4      P6                  pR$p\)        VV^R7       VP8                  P;                  4        VP=                  4        VP8                  P;                  4        R# )%   )Zfigsizerj   Z
Annotation->)
arrowstyleFbaselinerq   )ZxyZxytext
arrowpropsZclip_onZvarp   Tr   r   dataaxes fractionxyboxxycoordsr^   Zbox_alignmentr{   )Zzoom333333?zoffset points)r   r   r^   r#   r{   Zget_)ZatolZtight)Zbbox_inchesN)rw      )r    r&   r    r&   )?r   )皙?r   )ii   皙ɿr   r   r   )r   g333333ӿ)r    iK   )gffffft@gYn@g     0}@gfffffr@)g1g      `@gfffffi@gd@)g     f@g      @g     l@g9W@)i^  i  rw   )r'   ZrcParamsZupdateZrcParamsDefaultr(   ZaxisannotateZdictr
   r)   ZCircler.   r   r   ri   ZrandomZrandr_   ZaxesZgetattrr   ZextentsioZBytesIOZsavefigZseekZimreadshaper:   r;   rF   )rv   r2   r3   Zan1r4   ZpZab3rl   Zab6Zbb1Ztarget1Zbb3Ztarget3Zbb6Ztarget6Zbufr   Ztargetshapes   &                 r7   test_annotationbbox_extentsr     s   LL++,ll6s3GCGGL
++lx
!%!6#  0C 
RQ	-B	2&AMM!
b"X[6#2($(D$9;C MM#	RYY^^B+!	4BHHM
Zw"1#2$(D$9;C MM# #k]+
,
.C*GCKKq1 #k]+
,
.C*GCKKq1
#k]+
,
.C)GCKKq1 **,CKKK)HHQKJJsO!!EKE;Q/ JJOOJJOOr9   c                  s    R # ra   r[   r[   r9   r7   test_zorderr   ?  s    r9   c            
      sZ    \        ^^^ ^ RR7      p RRRR/p\        V RR.RRRRVR	7      pR
# )   Tr   ry   rx   Zrelposr   r|   r}   r~   N)r   gffffff?r   r   )r
   r   )r4   r{   rm         r7   test_arrowprops_copiedr   C  s@    	RQ	-Bh9J	RHK&"1#-
/Br9   alignc           
      s^   \         P                  ! ^HR7      pVP                  P                  4       p^
^rC^^<re\	        W44      p\	        WV4      p\        Wx.V R7      p	V	P                  V4       V	P                  V4      p
V	P                  W4      w  r\        V
P                  ^ ^ W5,           \        WF4      34       V R9   d   ^ pM&V R9   d
   Wd,
          pMV R8X  d   Wd,
          ^,          p\        V	P                  4        Uu. uF  qP                  4       NK  	  upWX,           3W,           V3.4       \        Wx.V R7      pVP                  V4       VP                  V4      p
VP                  W4      w  r\        V
P                  ^ \        WF4      ) \        W54      WF,           34       V R9   d   ^ pM&V R9   d
   WS,
          pMV R8X  d   WS,
          ^,          p\        VP                  4        Uu. uF  qP                  4       NK  	  upVX,           V3WV,
          3.4       R# u upi u upi )iH   )rj   )Zchildrenr   r   N)rz   rq   bottom)r@   top)r'   figurer:   Zget_rendererr
   r   r;   Zget_bboxZ
get_offsetr   ZboundsZmaxZget_childrenr   )r   r2   Zrendererx1y1Zx2Zy2Zr1Zr2ZhpackerbboxZpxZpyZy_heightr"   ZvpackerZx_heights   &                r7   test_packersr   M  s    **
Czz&&(H	R	B	R	B xu5GLLH%D/FBDKK!QR!=>..	"	"7	(	Gq=W5I5I5KL5KE%%'5KLx-(27B-8: xu5GLLH%D/FBDKK!c"k\3r;!HI..	"	"7	(	Gq=W5I5I5KL5KE%%'5KL8mR(2Bw-8:% M$ Ms   H%0H*c                  s    \         P                  ! 4       w  r\        R R4      p\        VRR/RR7      pVP	                  V4       V P                  4        R# )foor>   r   rT)patch_attrs
draw_frameN)r'   r(   r	   r   r.   Zdraw_without_rendering)r2   r3   ZatpbrG   r7   test_paddedbox_default_valuesr   ~  sF    llnGC	el	+B	2K#5$	GBMM" r9   c            
      sz    \        \        ^^^ ^ RR7      RRR7      p \        \        ^^^ ^ RR7      RR	RRR7      p R# )
r   Tr   r|   )r   r}   )r   r   r^   Nr%   )r   g?)r   r
   )rm       r7   test_annotationbbox_propertiesr     sE    	BAqt<j!'
)B
 
BAqt<j)F"1
3Br9   c                  s`    \        R 4      p V P                  R4       V P                  R4       R# )FooBarTN)r   set_textZset_multilinebaseline)tar   r7   test_textarea_propertiesr     s'    	%B KKT"r9   Zpng)Z
extensionsc                 s    VP                  4       p\        R R4      pVP                  V4       V P                  4       p\        RR4      pVP                  V4       VP                  P	                  R 4       R# )r   r>   r   N)Zadd_subplotr	   r.   Ztxtr   )Zfig_testZfig_refZax_refrr   Zax_testrs   s   &&    r7   test_textarea_set_textr     sd      "F-E
e""$G-Eu	IIur9   zpaddedbox.pngc                  s   \         P                  ! 4       w  r\        R 4      p\        V^RR/RR7      p\	        RVR7      pVP                  V4       \        R4      p\        V^
RR/R	7      p\	        R
VR7      pVP                  V4       \        R4      p\        V^RR7      p\	        RVR7      pVP                  V4       R# )r   r   r   T)r#   r   r   r>   )r"   ZbarZb)r#   r   r=   Zfoobar)r#   r   r?   N)r'   r(   r   r   r   r.   )r2   r3   r   r   rm   rt   r7   test_paddedboxr     s    llnGC	%B	21;*<	NB	<r	2BMM"	%B	22K+=	>B	=	3BMM"	(	B	22$	/B	=	3BMM"r9   c                  s    \         P                  ! 4       w  rVP                  R R4      pVP                  R4       VP	                  4        \        RV P                  ^^4      P                  4        R# )r   Tbutton_release_eventNr%   )r'   r(   r   	draggableZremover   r:   rk   )r2   r3   Zanr   r7   test_remove_draggabler     sP    llnGC	UH	%BLLIIK%szz1a8AACr9   c                  s|   \         P                  ! 4       p V P                  4       P                  . RO4      P	                  RR4      pVP                  R4       V P                  P                  4        \        RV P                  ^^4      P                  4        \        RV P                  ^^4      P                  4        \        RV P                  ^^4      P                  4        VP                  4       p\        RV P                  VP                  ^,           VP                  ^,           4      P                  4        R# )	r    r   Tre   r   Zscroll_eventN)r    r    r&   r&   r$   )r'   r   Z
subfiguresZadd_axesr   r   r:   r;   r   rk   Zget_window_extentr   r   )r2   Zannr   r   r7   test_draggable_in_subfigurer     s    
**,C
..

#
#L
1
:
:5&
ICMM$JJOO#SZZA6??A %szz1a8AAC ~szz1a099;   "D#SZZDGGAIFOOQr9   )   r   r   )   r   r    rh   N)r   r&   r    rh   )rD   rR   rX   )r   r&   rg   )r    rw   i   )rJ   rJ   rJ   )r    g?r   )r    rf   i   )r    g      @r   )r   rg   r&   )r    rg   rw   )r   rg   r&   r   )r    r   r&   r   )r   r&   ro   )r;   r_   r`   )r}   rd   rc   r|   )rz   r   r   rq   r@   r   )<Zcollectionsr   r   Znumpyri   Znumpy.testingr   rZ   Zmatplotlib.testing.decoratorsr   r   Zmatplotlib.pyplotZpyplotr'   Zmatplotlib.patchesZpatchesr)   Zmatplotlib.linesZlinesr+   Zmatplotlib.backend_basesr   r   Zmatplotlib.offsetboxr   r   r	   r
   r   r   r   r   r   r   r   r8   r<   rC   rH   ZmarkZparametrizerN   rO   rV   rW   rY   r\   rn   ru   r   r   r   r   r   r   r   r   r   r   r   r[   r9   r7   <module>r      sl   " 	  )  O  % ! <O O O O
 '(d;  < F"J*
 %3%#sDF"9:0!=>7 ? 1 ;F
7 Y ?
@ 719~?b)_>Q	N<: ,, 7Dda5FHb)_>Q,<>: ,, 79~?QDA7G3HJ4Q!YA: ,,K
 '@A"#/# B/d +,$gN O +(FG7 H7t-,  #> ?,:?,:^!
+& ( ) ?#WE F&D)r9   