B
    Mô`R  ã               @   sª   d dl Zd dlmZ d dlmZ d dlmZ	 edgdd�dd„ ƒZ
edgdd	d
�dd„ ƒZedgƒdd„ ƒZedgƒdd„ ƒZdd„ Zdd„ Zedgdd	d�dd„ ƒZdS )é    N)Úimage_comparisonZpatheffect1T)Úremove_textc              C   s�   t  d¡} |  ddgddgg¡ | jdddtdd	dd
�ddtjddd�gd�}|j tj	ddd�t 
¡ g¡ tjddd�g}| jdd|d� d S )Néo   é   é   é   Útest)g      ð?g      ð?)g        r   z->Zangle3)Z
arrowstyleZconnectionstyleÚlwé   ÚcenterÚw)Ú	linewidthÚ
foreground)Z
arrowpropsÚsizeÚhaÚpath_effectsé   Tú-)Z	linestyler   )ÚpltÚsubplotÚimshowZannotateÚdictr   Ú
withStrokeZarrow_patchÚset_path_effectsÚStrokeÚNormalZgrid)Zax1ÚtxtÚpe© r   úE/tmp/pip-unpacked-wheel-0c1wfn4v/matplotlib/tests/test_patheffects.pyÚtest_patheffect1   s    

r    Zpatheffect2Zmpl20)r   Ústylec              C   s€   t  d¡} t d¡ d¡}| j|dd� | j|dd�}t j|jt	j
dd	d
�gd� | j|ddd�}t j|t	j
dd	d
�gd� d S )Nr   é   )r   r   Znearest)ÚinterpolationÚk)Úcolorsr   r   )r   r   )r   z%2.0fT)ÚfmtZuse_clabeltext)r   r   ÚnpZarangeZreshaper   ÚcontourZsetpÚcollectionsr   r   Úclabel)Zax2ZarrZcntrZclblsr   r   r   Útest_patheffect2   s    
r+   Zpatheffect3c              C   s
  t jdddddgddd�\} |  t ¡ t ¡ g¡ t jdtjddd	�gd
� t j| gdgddd�}|j	 t 
¡ g¡ t jdddddddœd�}tjddd	�tj
ddd�g}| |¡ | ¡  |¡ tjdddd�tjddd d!�g}t  ¡ jd"d#d$d%d&d'd(�}| |¡ d S ))Nr   r   r   é   zo-b)r	   ztesting$^{123}$Úr)r   r   )r   z
Line 1$^2$Tz
upper left)ZfancyboxÚlocr   z	Drop testÚwhitezcircle,pad=0.1Zred)ÚboxstyleÚcolor)r1   Zbboxg      @r$   )é   éýÿÿÿÚblue)Zshadow_rgbFace)r,   éüÿÿÿZxxxxZgray)ÚoffsetZhatchÚ	facecolorÚblackgš™™™™™ñ?)Ú	edgecolorr7   r	   g{®Gáz”?gš™™™™™¹?zHatch shadowéK   iè  r   )ZfontsizeZweightÚva)r   Úplotr   r   ÚSimpleLineShadowr   Útitler   ZlegendZlegendPatchZwithSimplePatchShadowÚtextr   Zget_bbox_patchÚPathPatchEffectZgcf)Úp1Zlegr?   r   Útr   r   r   Útest_patheffect3,   s*    


rC   zstroked_text.pngc           
   C   s¨   dddddddg} d}t  d	d	d
d
g¡}xXt| ƒD ]L\}}|jdd|d  |dd|ddœd�}| tj|d dd�t ¡ g¡ q2W | d	d
¡ | 	d	d
¡ | 
d¡ d S )NzA B C D E F G H I J K LzM N O P Q R S T U V WzX Y Z a b c d e f g h i jzk l m n o p q r s t u vzw x y z 0123456789z!@#$%^&*()-=_+[]\;'z,./{}|:"<>?é2   r   r   g{®Gáz„?gÍÌÌÌÌÌì?g¤p=
×£À?Úleftr   r/   )r   r;   r   r1   )ÚxÚyÚsZfontdicté
   r8   )r   r   Úoff)r   ZaxesÚ	enumerater?   r   r   r   r   Zset_xlimZset_ylimZaxis)Ztext_chunksZ	font_sizeZaxÚiÚchunkr?   r   r   r   Útest_patheffects_stroked_textH   s&    rN   c              C   sh   t jdd�} t  tdƒ¡\}| t ¡ t ¡ g¡ | j 	¡ }t 
| ¡ |¡}| d¡| d¡ksdt‚d S )Né–   )ZdpirI   é   )r   Úfigurer<   Úranger   r   r=   r   ZcanvasZget_rendererZPathEffectRendererZget_path_effectsZpoints_to_pixelsÚAssertionError)ZfigrA   ZrendererZpe_rendererr   r   r   Ú test_PathEffect_points_to_pixelsd   s    

rT   c              C   s   t jdd�} | jdkst‚d S )N)r,   r   )r6   )r   ZSimplePatchShadowÚ_offsetrS   )r   r   r   r   Útest_SimplePatchShadow_offsetq   s    rV   Ú
collectiong¸…ëQ¸ž?)Ztolr!   c              C   s¼   t  t  ddd¡t  ddd¡¡\} }t  | ¡t  |¡ }t |¡}tjddd	d
�tj	dd�g}x|j
D ]}| |¡ qfW x>tj|dd�D ],}| tjddd�g¡ | ddddœ¡ qˆW d S )Nr   rI   rO   éûÿÿÿr   éd   r8   Únoneé   )r9   r7   r   )r   r/   )r%   r$   r   )r   r   Zsawtoothr4   )r0   r7   r9   )r'   ZmeshgridZlinspaceÚsinÚcosr   r(   r   r@   r   r)   r   r*   r   Zset_bbox)rF   rG   ÚdataÚcsr   rW   r?   r   r   r   Útest_collectionv   s    $

r`   )Znumpyr'   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.patheffectsZpatheffectsr   r    r+   rC   rN   rT   rV   r`   r   r   r   r   Ú<module>   s   