
    h              	          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/\R                  " 5       S:X  a  S OSS9S 5       r\" S	/5      S
 5       rS r\" S/S\R                  " 5       S:X  a  S OS\" SS9S9S 5       r\" S/S\R                  " 5       S:X  a  S OS\" SS9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      U/var/www/html/env/lib/python3.13/site-packages/matplotlib/tests/test_arrow_patches.py
draw_arrowr      s2    KKS1W~jr1#&30  1    fancyarrow_test_imagex86_64g~jt?)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.pngc                  >   [         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@g      ?r(   g5@centerwr
   )boxstyler   r   )har   	transformbbox)r,   BoxStyle
get_stylesr1   r/   figurer2   sortedtexttransFigurer   )stylesnspacing	figheightr4   fontsizei	stylenames           r   test_boxarrowrP      s     ))+FFAGr!I
**gy37
8CH!&.1(3.	99??I##>	 	 	@ 2r   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?rT   ->d   )posAposBlwr   mutation_scale)r/   rE   add_subplotset_xlimset_ylim	add_patchr,   FancyArrowPatch)fig2r   s     r   !__prepare_fancyarrow_dpi_cor_testrd   4   sq     ::/RHD				BKKAKKALL))z
-.49<> ? Kr   zfancyarrow_dpi_cor_100dpi.pngTg{Gz?rY   )rV   )remove_textr   savefig_kwargc                      [        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rd    r   r   test_fancyarrow_dpi_cor_100dpirj   F   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.
Nrh   ri   r   r   test_fancyarrow_dpi_cor_200dpirm   U   s
     &'r   zfancyarrow_dash.pngdefault)re   stylec                      [         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      $@   dashedr
   )r   connectionstyler]   	linewidth	linestylecolorangle3dotted)r/   r0   r,   rb   ra   )r4   r   ee2s       r   test_fancyarrow_dashr{   a   sv    llnGC  ,11L04+,+3'*	,A 
	!	!&*-22:15,-,4(+
-B LLOLLr   zarrow_styles.pngmpl20)ro   re   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!   rq   g?g?   )r   r]   )z]-[z]-z-[z|-|-z,angleA=ANGLEz,angleB=ANGLEi<   ANGLEg?g?)r,   r-   rD   r1   r/   r0   r_   r`   subplots_adjustr2   rF   rb   ra   replacestr)rI   rJ   r4   r   rN   rO   patchro   jangler   s              r   test_arrow_stylesr   v   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!   rW   r   rX   r   )r   rs   r]   )r,   ConnectionStylerD   r1   r/   r0   r_   r`   r2   rF   rb   ra   )rI   rJ   r4   r   rN   rO   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   rk   )angleAangleB)r    r    r   )rs   gh@)
r,   r   Angle3rb   pytestraises
ValueErrorr/   gcara   )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pyplotr/   matplotlib.testing.decoratorsr   matplotlib.patchespatchesr,   r   machiner:   rP   rd   r   rj   rm   r{   r   r   r   ri   r   r   <module>r      s      : %1 *+#++-9auF?F? ,-.@ /@($ 23#++-9at $/	(/	( 23#++-9at $/(/( ()t9M N( %&g4#++-9atE E > *+7#++-9auFF 
r   