
    (?e"                     <   d dl Z d dlZd dlmZ d dlmZ d dlmZ	 d Z
 edg          d             Z edg          d             Zd Z ed	gd
 ej                    dk    rd nd ed                    d             Z edgd
 ej                    dk    rd nd ed                    d             Z edgd
d          d             Z edgdd
 ej                    dk    rd nd          d             Z edgdd
          d             Zd  ZdS )!    N)image_comparisonc                 d    |                      ddd|z   fddt          |dd                     d S )	N       ?r   r      bk)
arrowstylefcec)xyxytextsize
arrowprops)annotatedict)axtrs      Clib/python3.11/site-packages/matplotlib/tests/test_arrow_patches.py
draw_arrowr      sP    KKS1W~jr1#&30 0 0  1 1 1 1 1    fancyarrow_test_imagec            	         g d} ddt           j                                        g}t          j        t          |          t          |           ddt          d                    \  }}t          |           D ]L\  }}t          |          D ]7\  }}|||f         }t          |||           |	                    dd	           8Md S )
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_fancyarrowr8      s     	 A	(H/55778A|CFFCFFE$,QI I IHC Q<< ? ?R || 	? 	?GCS#XBr2r"""NNUN>>>>	?? ?r   zboxarrow_test_image.pngc                  j   t           j                                        } t          |           }d}||z  dz   }t	          j        d|dz  f          }d}t          t          |                     D ]B\  }}|                    d||z
  |z  dz
  |z  |d||j	        t          |dd	
                     Cd S )Ng333333?r   gUUUUUU@g      ?r&   g5@centerwr
   )boxstyler   r   )har   	transformbbox)r*   BoxStyle
get_stylesr/   r-   figurer0   sortedtexttransFigurer   )stylesnspacing	figheightr2   fontsizei	stylenames           r   test_boxarrowrN      s     ))++FFAGWr!I
*gy37
8
8
8CH!&..11 @ @9A(3.	99?I##>>>	 	 	@ 	@ 	@ 	@@ @r   c            	         t          j        ddd          } |                                 }|                    ddg           |                    ddg           |                    t          j        ddd	d
d                     | S )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?rR   ->d   )posAposBlwr   mutation_scale)r-   rC   add_subplotset_xlimset_ylim	add_patchr*   FancyArrowPatch)fig2r   s     r   !__prepare_fancyarrow_dpi_cor_testrb   3   s     :/RHHHD					BKKAKKALL)z
-.49<> > > ? ? ? Kr   zfancyarrow_dpi_cor_100dpi.pngTx86_64g{Gz?rW   )rT   )remove_texttolsavefig_kwargc                  "    t                       dS )a   
    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rb    r   r   test_fancyarrow_dpi_cor_100dpirj   E   s     &'''''r   zfancyarrow_dpi_cor_200dpi.png   c                  "    t                       dS )z
    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   T   s     &'''''r   zfancyarrow_dash.pngdefault)rd   stylec            
          t          j                    \  } }t          j        dddddddd	          }t          j        dddd
dddd	          }|                    |           |                    |           d S )N)r   r   r   z-|>zangle3,angleA=0,angleB=90g      $@   dashedr
   )r   connectionstyler[   	linewidth	linestylecolorangle3dotted)r-   r.   r*   r`   r_   )r2   r   ee2s       r   test_fancyarrow_dashr{   `   s    lnnGC ,11L04+,+3'*	, 	, 	,A 
	!&*-22:15,-,4(+
- 
- 
-B LLOOOLLr   zarrow_styles.pngmpl20g{Gzt?)ro   rd   re   c                  H   t           j                                        } t          |           }t	          j        d          \  }}|                    dd           |                    d|           |                    dddd           t          t          |                     D ]H\  }}t          j        d|dz  d	z  z   |fd
|dz  d	z  z   |f|d          }|                    |           It          g d          D ]\  }}|}|d         dk    r|dz  }|d         dk    r|dz  }t          ddg          D ]e\  }}	|                    dt          |	                    }
t          j        dd|z  |z   fdd|z  |z   f|
d          }|                    |           fd S )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+   rB   r/   r-   r.   r]   r^   subplots_adjustr0   rD   r`   r_   replacestr)rG   rH   r2   r   rL   rM   patchro   jangler   s              r   test_arrow_stylesr   u   s     ++--FFAl6***GCKK1KKAQaq999!&..11  9(#Q*<a)@*.!a%*=q)A4=8:< < < 	U!"<"<"<==    9Q<3_$ER=C_$E!3),, 	  	 HAuwE

;;J,dAaC!G_sAaC!Gn8B<>@ @ @E LL	    r   zconnection_styles.png)ro   rd   c                     t           j                                        } t          |           }t	          j        d          \  }}|                    dd           |                    d|           t          t          |                     D ]:\  }}t          j
        d|fd|dz   fd	|d
          }|                    |           ;d S )N)   
   r:   r   r#   r~   r   rU   r   rV   r   )r   rs   r[   )r*   ConnectionStylerB   r/   r-   r.   r]   r^   r0   rD   r`   r_   )rG   rH   r2   r   rL   rM   r   s          r   test_connection_stylesr      s    %0022FFAl7+++GCKK1KKA!&..11  9(#qCS>489B8:< < < 	U r   c                     t           j                            dd          } t          j        dd|           }t	          j        t                    5  t          j                    	                    |           d d d            n# 1 swxY w Y   t           j                            dd          }t          j        dd|          }t          j                    	                    |           d S )N   rk   )angleAangleB)r   r   r   )rs   gh@)
r*   r   Angle3r`   pytestraises
ValueErrorr-   gcar_   )conn_style_1p1conn_style_2p2s       r   test_invalid_intersectionr      s   +22"S2IIL		!(H2>
@ 
@ 
@B	z	"	"    		B                              +22"U2KKL		!(H2>
@ 
@ 
@BGIIs   'BB	B	)r   platformmatplotlib.pyplotpyplotr-   matplotlib.testing.decoratorsr   matplotlib.patchespatchesr*   r   r8   rN   rb   machiner   rj   rm   r{   r   r   r   ri   r   r   <module>r      s`           : : : : : : % % % % % %1 1 1 *+,,? ? -,? ,-..@ @ /.@(  $ 23+8+--99aat $/ / /	( 	(/ /	( 23+8+--99aat $/ / /( (/ /( ()t9MMM  NM( %&g4+8+--99aauF F F   F F > *+7MMM  NM 
 
 
 
 
r   