U
    \	aC                     @   s   d dl Zd dlmZ d dlm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edgddgdd d! ZdS )"    N)image_comparison)PathZpatheffect1T)remove_textc                  C   s   t  } | 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         test)      ?r	   )        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)ax1txtpe r"   E/tmp/pip-unpacked-wheel-wjyw_3jo/matplotlib/tests/test_patheffects.pytest_patheffect1
   s(    
  r$   Zpatheffect2Zmpl20)r   stylec                  C   s~   t  } 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 )N   )r   r   Znearest)interpolationkcolorsr   r   r   r   z%2.0fT)fmtZuse_clabeltext)r   r   npZarangeZreshaper   contoursetpcollectionsr   r   clabel)ax2ZarrZcntrZclblsr"   r"   r#   test_patheffect2   s    r3   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}$rr   r+   z
Line 1$^2$Tz
upper left)Zfancyboxlocr   z	Drop testwhitezcircle,pad=0.1Zred)boxstylecolor)r9   Zbboxg      @r(   )   blue)Zshadow_rgbFace)r4   ZxxxxZgray)offsetZhatch	facecolorblackg?)	edgecolorr?   r   g{Gz?g?zHatch shadowK   i  r   )ZfontsizeZweightva)r   plotr   r   SimpleLineShadowr   titler   legendZlegendPatchZwithSimplePatchShadowtextr   Zget_bbox_patchPathPatchEffectZgcf)p1ZlegrH   r!   tr"   r"   r#   test_patheffect3.   s:    

rL   zstroked_text.pngc               
   C   s   dddddddg} d}t d	d	d
d
g}t| D ]L\}}|jdd|d  |dd|ddd}|tj|d ddt g q0|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{Gz?g?gp=
ף?leftr   r7   )r   rC   r   r9   )xysZfontdict
   r@   r   off)r   Zaxes	enumeraterH   r   r   r   r   set_xlimset_ylimaxis)Ztext_chunksZ	font_sizeZaxichunkrH   r"   r"   r#   test_patheffects_stroked_textJ   s2    	 rZ   c                  C   sh   t jdd} t td\}|t t g | j	 }t
| |}|d|dksdtd S )N   )ZdpirR      )r   figurerD   ranger   r   rE   r   ZcanvasZget_rendererZPathEffectRendererZget_path_effectsZpoints_to_pixelsAssertionError)figrJ   ZrendererZpe_rendererr"   r"   r#    test_PathEffect_points_to_pixelsf   s    

 ra   c                  C   s   t jdd} | jdkstd S )N)r4   r   )r>   )r   ZSimplePatchShadow_offsetr_   )r!   r"   r"   r#   test_SimplePatchShadow_offsets   s    rc   
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}|j
D ]}|| qdtj|ddD ],}|tjdddg |dddd qd S )Nr   rR   r[   r   d   r@   none   )rA   r?   r   )r   r7   r)   r(   r   )r   r   Zsawtoothr<   )r8   r?   rA   )r-   meshgridlinspacesincosr   r.   r   rI   r   r0   r   r1   r   Zset_bbox)rO   rP   datacsr!   rd   rH   r"   r"   r#   test_collectionx   s"    $




ro   ZtickedstrokeZpng)r   
extensionsc               	   C   s  t jdddd\} \}}}t }tj|ddtjdddd	gd
}|| |	d |
dd |dd |jddgddgdtjdddgd d}tdd|}dt|d  d }|j||dt gd |  d}d}	tdd|}
tdd|	}t|
|\}}d| | d  }|d|  d  }d|d  | }|j|||dgd d!}t j|jtjdd"gd# |j|||dgd$d!}t j|jtjd%dd&gd# |j|||dgd'd!}t j|jtjdd(gd# |
dd |dd d S ))Nr   r   )rh   r4   )Zfigsizerg   r   irR   )anglespacinglength)r?   r   r   equalr          )rr   rq   )labelr   e   r
   r	   g333333?   g?i   gMbP?g      @g      @r4   g?r;   )r(   r)   )rq   r+   )r5   <   )rq   rs   )b)rr   )r   Zsubplotsr   Zunit_circlepatchesZ	PathPatchr   ZwithTickedStrokeZ	add_patchrW   rU   rV   rD   r-   rj   rk   rG   ri   r.   r/   r0   )r`   r   r2   Zax3pathpatchZnxrO   rP   nyZxvecZyvecx1Zx2Zg1Zg2Zg3Zcg1Zcg2Zcg3r"   r"   r#   test_tickedstroke   sV    


r   )Znumpyr-   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.patheffectsZpatheffectsr   Zmatplotlib.pathr   Zmatplotlib.patchesr   r$   r3   rL   rZ   ra   rc   ro   r   r"   r"   r"   r#   <module>   s&   




