a
    ëÝEb"  ã                   @   s.  d dl Z d dlZd dlmZ d dlmZ d dlmZ	 dd„ Z
edgƒdd„ ƒZedgƒd	d
„ ƒZdd„ Zedgde ¡ dkr€d ndedd�d�dd„ ƒZedgde ¡ dkr°d ndedd�d�dd„ ƒZedgddd�dd„ ƒZedgd de ¡ dkrúd nd!d"�d#d$„ ƒZed%gd dd&�d'd(„ ƒZd)d*„ ZdS )+é    N)Úimage_comparisonc              
   C   s*   | j ddd| fddt|ddd�d� d S )	NÚ ç      à?©r   r   é   ÚbÚk)Ú
arrowstyleÚfcÚec)ZxyZxytextÚsizeZ
arrowprops)ZannotateÚdict)ÚaxÚtÚr© r   úc/home/ja/django-apps/lartica_env/lib/python3.9/site-packages/matplotlib/tests/test_arrow_patches.pyÚ
draw_arrow   s
    ÿÿr   Zfancyarrow_test_imagec            	      C   sŒ   g d¢} ddt j ¡ g}tjt|ƒt| ƒddtdd�d�\}}t| ƒD ]@\}}t|ƒD ].\}}|||f }t|||ƒ |j	ddd	� qVqFd S )
N)çš™™™™™Ù?ç333333Ó?çš™™™™™É?çš™™™™™¹?r   ÚfancyÚsimpleF)é   g      @é   )Zaspect)ZsqueezeÚfigsizeZ
subplot_kw)Z	labelleftZlabelbottom)
ÚmpatchesÚ
ArrowStyleÚFancyÚpltÚsubplotsÚlenr   Ú	enumerater   Ztick_params)	r   r   ÚfigZaxsZi_rÚr1Zi_tÚt1r   r   r   r   Útest_fancyarrow   s    
ÿ
r'   zboxarrow_test_image.pngc                  C   sˆ   t j ¡ } t| ƒ}d}|| d }tjd|d fd�}d}tt| ƒƒD ]<\}}|jd|| | d | |d||j	t
|dd	d
�d� qFd S )Ng333333ó?r   gUUUUUU@g      ø?©r   g™™™™™™5@ÚcenterÚwr   )Zboxstyler
   r   )Zhar   Z	transformZbbox)r   ZBoxStyleÚ
get_stylesr"   r    Úfigurer#   ÚsortedÚtextZtransFigurer   )ÚstylesÚnÚspacingZ	figheightr$   ZfontsizeÚiÚ	stylenamer   r   r   Útest_boxarrow   s    
ür4   c               	   C   sR   t jdddd�} |  ¡ }| ddg¡ | ddg¡ | tjd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!
    Zfancyarrow_dpi_cor_test)é   é   é2   )r   Údpir   r   )r   r   )çš™™™™™é?g333333ã?r6   ú->éd   )ZposAZposBZlwr	   Úmutation_scale)r    r,   Zadd_subplotÚset_xlimÚset_ylimÚ	add_patchr   ÚFancyArrowPatch)Zfig2r   r   r   r   Ú!__prepare_fancyarrow_dpi_cor_test3   s    þrA   zfancyarrow_dpi_cor_100dpi.pngTÚx86_64g{®Gáz”?r;   )r8   )Úremove_textÚtolZsavefig_kwargc                   C   s
   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©rA   r   r   r   r   Útest_fancyarrow_dpi_cor_100dpiE   s    rF   zfancyarrow_dpi_cor_200dpi.pngéÈ   c                   C   s
   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.
    NrE   r   r   r   r   Útest_fancyarrow_dpi_cor_200dpiT   s    	rH   zfancyarrow_dash.pngÚdefault)rC   Ústylec               
   C   sX   t  ¡ \} }tjddddddddd	�}tjdddd
ddddd	�}| |¡ | |¡ d S )N)r   r   r   z-|>zangle3,angleA=0,angleB=90g      $@é   Zdashedr   )r	   Úconnectionstyler<   Z	linewidthZ	linestyleÚcolorZangle3Zdotted)r    r!   r   r@   r?   )r$   r   ÚeÚe2r   r   r   Útest_fancyarrow_dash`   s&    úú
rP   zarrow_styles.pngZmpl20g{®Gázt?)rJ   rC   rD   c                  C   s>  t j ¡ } t| ƒ}tjdd�\}}| dd¡ | d|¡ |jddddd� t	t
| ƒƒD ]D\}}t jd|d d	  |fd
|d d	  |f|dd�}| |¡ qXt	g d¢ƒD ]Ž\}}|}|d dkrÊ|d7 }|d dkrÞ|d7 }t	ddgƒD ]L\}}	| dt|	ƒ¡}
t jdd| | fdd| | f|
dd�}| |¡ qêqªd S )N)r   r   r(   r   r   éÿÿÿÿ)ÚleftÚrightÚbottomÚtopr   rK   gš™™™™™©?gÍÌÌÌÌÌÜ?é   )r	   r<   )z]-[z]-z-[z|-|ú-z,angleA=ANGLEz,angleB=ANGLEiâÿÿÿé<   ZANGLEgš™™™™™á?gÍÌÌÌÌÌì?)r   r   r+   r"   r    r!   r=   r>   Zsubplots_adjustr#   r-   r@   r?   ÚreplaceÚstr)r/   r0   r$   r   r2   r3   ÚpatchrJ   ÚjZangler	   r   r   r   Útest_arrow_stylesu   s4    
ý þr]   zconnection_styles.png)rJ   rC   c                  C   s~   t j ¡ } t| ƒ}tjdd�\}}| dd¡ | d|¡ tt	| ƒƒD ]2\}}t j
d|fd|d fd	|d
d�}| |¡ qFd S )N)é   é
   r(   r   r   rQ   r   r9   r   r:   rV   )r	   rL   r<   )r   ÚConnectionStyler+   r"   r    r!   r=   r>   r#   r-   r@   r?   )r/   r0   r$   r   r2   r3   r[   r   r   r   Útest_connection_styles–   s    
ýra   c                  C   sŠ   t jjddd�} t jdd| d�}t t¡� t ¡  	|¡ W d   ƒ n1 sN0    Y  t jjddd�}t jdd|d�}t ¡  	|¡ d S )Né   rG   )ZangleAZangleB)r   r   r   )rL   gÍÌÌÌÌüh@)
r   r`   ZAngle3r@   ÚpytestZraisesÚ
ValueErrorr    Zgcar?   )Zconn_style_1Úp1Zconn_style_2Úp2r   r   r   Útest_invalid_intersection§   s    ÿ,ÿrg   )rc   ÚplatformZmatplotlib.pyplotZpyplotr    Zmatplotlib.testing.decoratorsr   Zmatplotlib.patchesZpatchesr   r   r'   r4   rA   Úmachiner   rF   rH   rP   r]   ra   rg   r   r   r   r   Ú<module>   s:   

þ
þ
	

ÿ

