
    
3j4                     8   S SK r S SKrS SKJr  S SKJr  S SKJr	  S r
\" S/S\R                  " 5       S:X  a  S OSS9S	 5       r\" S
/SS9S 5       r\" S/SS9S 5       rS r\" S/S\" SS9S\R                  " 5       S:X  a  S OSS9S 5       r\" S/S\" SS9S\R                  " 5       S:X  a  S OSS9S 5       r\" S/SSS9S 5       r\" S/SS\R                  " 5       S:X  a  S OSS 9S! 5       r\" S"/SS\R                  " 5       S:X  a  S OS#S 9S$ 5       rS% rg)&    N)image_comparisonc                 F    U R                  SSSU-   4SS[        USSS9S9  g )	N       ?r   r      bk)
arrowstylefcec)xyxytextsize
arrowprops)annotatedict)axtrs      ]/home/wildlama/miniconda3/lib/python3.13/site-packages/matplotlib/tests/test_arrow_patches.py
draw_arrowr      s2    KKS1W~jr1#&30  1    zfancyarrow_test_image.png_classic_testx86_64g~jt?)styletolc            
      H   / SQn SS[         R                  R                  5       /n[        R                  " [        U5      [        U 5      SS[        SS9S9u  p#[        U 5       H;  u  pE[        U5       H'  u  pgX6U4   n[        XU5        UR                  SSS	9  M)     M=     g )
N)皙?333333?皙?皙?r   fancysimpleF)   g      @   )aspect)squeezefigsize
subplot_kw)	labelleftlabelbottom)
mpatches
ArrowStyleFancypltsubplotslenr   	enumerater   tick_params)	r   r   figaxsi_rr1i_tt1r   s	            r   test_fancyarrowr;      s     	 A	(H//5578A||CFCFE$,QIHC Q< |GC#XBrr"NNUN> $  r   zboxarrow_test_image.pngmpl20)r   c                  >   [         R                  R                  5       n [        U 5      nSnX-  S-   n[        R
                  " SUS-  4S9nSn[        [        U 5      5       H8  u  pgUR                  SX-
  U-  S-
  U-  USUUR                  [        USS	S
9S9  M:     g )Ng333333?r   gUUUUUU@      ?r)   癙5@centerwr
   boxstyler   r   )har   	transformbbox)r-   BoxStyle
get_stylesr2   r0   figurer3   sortedtexttransFigurer   )stylesnspacing	figheightr5   fontsizei	stylenames           r   test_boxarrowrU      s     ))+FFAGr!I
**gy37
8CH!&.1(3.	99??I##>	 	 	@ 2r   z"boxarrow_adjustment_test_image.pngc                     / SQn SS/SS/SS/SS/S	S
/S	S//nSnSn[        U 5      n[        U5      nXB-  nXS-  S-   n[        R                  " US-  US-  4S9nSn	[        U 5       He  u  p[        U5       HQ  u  pUR	                  XJ-
  U-  S-
  U-  X\-
  U-  S-
  U-  USSXR
                  [        U SUS    SUS    3SSS9S9  MS     Mg     g )N)larrowrarrowdarrowr>   Z      g      ?r   r   i   iig      @g?r?   r@   rA   z, head_width=r   z!,                     head_angle=r&   rB   r
   rC   )rE   var   rF   rG   )r2   r0   rJ   r3   rL   rM   r   )rN   casesspacing_horizontalspacing_verticalmrO   figwidthrQ   r5   rR   rS   rT   jcases                 r   test_boxarrow_adjustmentre   4   s-    ,F 
b		c
	r
	c
	
C	
CE  	FAE
A&H%+I
**hni#o>
?CH!&) 'GAHH%--3x?%++c1Y>h8i[d1gY G  $Qy$*.1c;  < ( *r   c            
          [         R                  " SSSS9n U R                  5       nUR                  SS5        UR	                  SS5        UR                  [        R                  " SSS	S
SS95        U $ )z
Convenience function that prepares and returns a FancyArrowPatch. It aims
at being used to test that the size of the arrow head does not depend on
the DPI value of the exported picture.

NB: this function *is not* a test in itself!
fancyarrow_dpi_cor_test)      2   )r)   dpir   r&   )r    r   )皙?g333333?ri   ->d   )posAposBlwr   mutation_scale)r0   rJ   add_subplotset_xlimset_ylim	add_patchr-   FancyArrowPatch)fig2r   s     r   !__prepare_fancyarrow_dpi_cor_testry   ^   sm     ::/RHD				BKK1KK1LL))z
-.49<> ? Kr   zfancyarrow_dpi_cor_100dpi.pngTrn   )rk   g{Gz?)remove_textsavefig_kwargr   r   c                      [        5         g)z
Check the export of a FancyArrowPatch @ 100 DPI. FancyArrowPatch is
instantiated through a dedicated function because another similar test
checks a similar export but with a different DPI value.

Remark: test only a rasterized format.
Nry    r   r   test_fancyarrow_dpi_cor_100dpir   p   s
     &'r   zfancyarrow_dpi_cor_200dpi.png   c                      [        5         g)zs
As test_fancyarrow_dpi_cor_100dpi, but exports @ 200 DPI. The relative size
of the arrow head should be the same.
Nr}   r~   r   r   test_fancyarrow_dpi_cor_200dpir      s
     &'r   zfancyarrow_dash.pngdefault)rz   r   c                      [         R                  " 5       u  p[        R                  " SSSSSSSSS	9n[        R                  " SSSS
SSSSS	9nUR	                  U5        UR	                  U5        g )N)r   r   r   z-|>zangle3,angleA=0,angleB=90g      $@r\   dashedr
   )r   connectionstylerr   	linewidth	linestylecolorangle3dotted)r0   r1   r-   rw   rv   )r5   r   ee2s       r   test_fancyarrow_dashr      sv    llnGC  ,11L04+,+3'*	,A 
	!	!&*-22:15,-,4(+
-B LLOLLr   zarrow_styles.png)r   rz   r   c            	         [         R                  R                  5       n [        U 5      n[        R
                  " SS9u  p#UR                  SS5        UR                  SU5        UR                  SSSSS9  [        [        U 5      5       HC  u  pE[         R                  " SUS-  S	-  -   U4S
US-  S	-  -   U4USS9nUR                  U5        ME     [        / SQ5       H  u  pEUnUS   S:w  a  US-  nUS   S:w  a  US-  n[        SS/5       HX  u  pUR                  S[        U	5      5      n
[         R                  " SSU-  U-   4SSU-  U-   4U
SS9nUR                  U5        MZ     M     g )N)r%   r%   r?   r   r&   )leftrightbottomtopr"   r\   g?g?   )r   rr   )z]-[z]-z-[z|-|-z,angleA=ANGLEz,angleB=ANGLEi<   ANGLEg?g?)r-   r.   rI   r2   r0   r1   rt   ru   subplots_adjustr3   rK   rw   rv   replacestr)rN   rO   r5   r   rS   rT   patchr   rc   angler   s              r   test_arrow_stylesr      su      ++-FFAll6*GCKK1KKAQaq9!&.1((#Q*<a)@*.!a%*=q)A4=8:< 	U 2 ""<=Q<3_$ER=C_$E!3),HAwE
;J,,dAaC!G_sAaC!Gn8B<>@E LL - >r   zconnection_styles.pngg9v?c            	      d   [         R                  R                  5       n [        U 5      n[        R
                  " SS9u  p#UR                  SS5        UR                  SU5        [        [        U 5      5       H5  u  pE[         R                  " SU4SUS-   4S	US
S9nUR                  U5        M7     g )N)   
   r?   r   r&   r   r"   rl   r   rm   r   )r   r   rr   )r-   ConnectionStylerI   r2   r0   r1   rt   ru   r3   rK   rw   rv   )rN   rO   r5   r   rS   rT   r   s          r   test_connection_stylesr      s     %%002FFAll7+GCKK1KKA!&.1((#qCS>489B8:< 	U 2r   c                     [         R                  R                  SSS9n [         R                  " SSU S9n[        R
                  " [        5         [        R                  " 5       R                  U5        S S S 5        [         R                  R                  SSS9n[         R                  " SSUS9n[        R                  " 5       R                  U5        g ! , (       d  f       Ng= f)N   r   )angleAangleB)r!   r!   r   )r   gh@)
r-   r   Angle3rw   pytestraises
ValueErrorr0   gcarv   )conn_style_1p1conn_style_2p2s       r   test_invalid_intersectionr      s    ++22"S2IL		!	!(H2>
@B	z	"	B 
# ++22"U2KL		!	!(H2>
@BGGI 
#	"s   %C
C#)r   platformmatplotlib.pyplotpyplotr0   matplotlib.testing.decoratorsr   matplotlib.patchespatchesr-   r   machiner;   rU   re   ry   r   r   r   r   r   r   r   r~   r   r   <module>r      s      : %1 ./#++-9auF?F? ,-W=@ >@( 78H&< I&<R$ 23 $_#++-9atE	(E	( 23 $_#++-9atE(E( ()t9M N( %&g4#++-9atE E > *+7#++-9auFF 
r   