3
$ßL]8  ã               @   s4  d dl Z d dlZd dljZd dlmZ d dljZ	dd„ Z
edgd�dd„ ƒZed	gd
gd�dd„ ƒZdd„ Zedgdd
gddijejƒ dƒedd�d�dd„ ƒZedgdd
gddijejƒ dƒedd�d�dd„ ƒZedgdd
gdd �d!d"„ ƒZed#gd
gd$dd%�d&d'„ ƒZed(g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Ú ç      à?é   ÚbÚk)Ú
arrowstyleÚfcÚec)ZxyZxytextÚsizeZ
arrowprops)r   r   )ZannotateÚdict)ÚaxÚtÚr© r   úK/tmp/pip-install-edjban26/matplotlib/matplotlib/tests/test_arrow_patches.pyÚ
draw_arrow   s    r   Zfancyarrow_test_image)Úbaseline_imagesc        	      C   sš   dddddg} ddt jjƒ g}tjt|ƒt| ƒdtd	d
�dd�\}}xPt| ƒD ]D\}}x:t|ƒD ].\}}|||f }t|||ƒ |j	ddd� q`W qNW d S )Ngš™™™™™Ù?g333333Ó?gš™™™™™É?gš™™™™™¹?r   ZfancyÚsimpleFT)Zaspecté   ç      @)ZsqueezeZ
subplot_kwÚfigsize)Z	labelleftZlabelbottom)r   r   )
ÚmpatchesÚ
ArrowStyleZFancyÚpltÚsubplotsÚlenr   Ú	enumerater   Ztick_params)	r   r   ÚfigZaxesZi_rZr1Zi_tÚt1r   r   r   r   Útest_fancyarrow   s    r    Zboxarrow_test_imageZpng)r   Ú
extensionsc              C   sŒ   t jjƒ } t| ƒ}d}|| d }tjd|d fd�}d}xLtt| ƒƒD ]<\}}|jd|| | d | |d||j	t
|d	d
d�d� qHW d S )Ng333333ó?g      à?é   g      ø?)r   g333333Ó?éH   ÚcenterÚwr   )Zboxstyler	   r
   )Zhar   Z	transformZbboxgUUUUUU@g™™™™™™5@)r   ZBoxStyleÚ
get_stylesr   r   Úfigurer   ÚsortedÚtextZtransFigurer   )ÚstylesÚnÚspacingZ	figheightr   ZfontsizeÚiÚ	stylenamer   r   r   Útest_boxarrow   s    
r/   c              C   sT   t jdddd�} | jdƒ}|jddgƒ |jddgƒ |j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_testr"   é   é2   )r   Údpiéo   r   é   ç333333Ó?çš™™™™™Ù?çš™™™™™é?ç333333ã?z->éd   )ZposAZposBZlwr   Úmutation_scale)r"   r0   )r5   r6   )r7   r8   )r   r'   Zadd_subplotÚset_xlimÚset_ylimÚ	add_patchr   ÚFancyArrowPatch)Zfig2r   r   r   r   Ú!__prepare_fancyarrow_dpi_cor_test4   s    

r?   Zfancyarrow_dpi_cor_100dpiTZaarch64g{®Gáz”?g        r9   )r2   )r   Úremove_textr!   Z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)r?   r   r   r   r   Útest_fancyarrow_dpi_cor_100dpiF   s    rA   Zfancyarrow_dpi_cor_200dpiéÈ   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.
    N)r?   r   r   r   r   Útest_fancyarrow_dpi_cor_200dpiV   s    
rC   Zfancyarrow_dashÚdefault)r   r@   r!   Ústylec           
   C   s`   ddl m}  tjƒ \}}| dddddddd	d
�}| dddddddd	d
�}|j|ƒ |j|ƒ d S )Nr   )r>   ç      à?z-|>zangle3,angleA=0,angleB=90g      $@é   Zdashedr   )r   Úconnectionstyler:   Z	linewidthZ	linestyleÚcolorZangle3Zdotted)r   r   )rF   rF   )r   r   )rF   rF   )Úmatplotlib.patchesr>   r   r   r=   )r>   r   r   ÚeÚe2r   r   r   Útest_fancyarrow_dashc   s$    
rM   Zarrow_stylesZmpl20)r   r!   rE   r@   c              C   s|   t jjƒ } t| ƒ}tjd
d�\}}|jddƒ |jd|ƒ x<tt	| ƒƒD ],\}}t j
d|fd|f|dd	�}|j|ƒ qHW d S )Né   é
   )r   r   r4   gš™™™™™¹?gš™™™™™é?é   )r   r:   )rN   rO   éÿÿÿÿ)r   r   r&   r   r   r   r;   r<   r   r(   r>   r=   )r*   r+   r   r   r-   r.   Úpatchr   r   r   Útest_arrow_styles}   s    
rS   Zconnection_stylesc              C   s‚   t jjƒ } t| ƒ}tjdd�\}}|jddƒ |jd|ƒ xBtt	| ƒƒD ]2\}}t j
d|fd|d fd	|d
d�}|j|ƒ qHW d S )NrN   rO   )r   r   r4   gš™™™™™¹?gš™™™™™é?g      à?z->rP   )r   rH   r:   )rN   rO   rQ   )r   ÚConnectionStyler&   r   r   r   r;   r<   r   r(   r>   r=   )r*   r+   r   r   r-   r.   rR   r   r   r   Útest_connection_stylesŽ   s    
rU   c              C   sv   t jjddd�} t jdd	| d�}tjtƒ� tjƒ j	|ƒ W d Q R X t jjddd�}t jd
d|d�}tjƒ j	|ƒ d S )Né   rB   )ZangleAZangleBçš™™™™™É?ç      à?)rH   gÍÌÌÌÌüh@)rW   rW   )rX   rX   )rW   rW   )rX   rX   )
r   rT   ZAngle3r>   ÚpytestZraisesÚ
ValueErrorr   Zgcar=   )Zconn_style_1Úp1Zconn_style_2Úp2r   r   r   Útest_invalid_intersection    s    r]   )rY   ÚplatformZmatplotlib.pyplotZpyplotr   Zmatplotlib.testing.decoratorsr   rJ   Zpatchesr   r   r    r/   r?   ÚgetÚmachiner   rA   rC   rM   rS   rU   r]   r   r   r   r   Ú<module>   s0   




