a
    s=ic                     @   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!d" Zed#gd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Normalgrid)ax1txtpe r#   r/home/droni/.local/share/virtualenvs/DPS-5Je3_V2c/lib/python3.9/site-packages/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    r4   Zpatheffect3c                  C   s  t jg d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 ))N)r   r   r      r   zo-br5   )r   ztesting$^{123}$r   rr   r,   z
Line 1$^2$Tz
upper left)Zfancyboxlocr   r   z	Drop testwhitezcircle,pad=0.1red)boxstylecolor)r;   bboxg      @r)   )   blue)Zshadow_rgbFace)r5   Zxxxxgray)offsetZhatch	facecolorblackg?)	edgecolorrC   r   g{Gz?g?zHatch shadowK   i  r   )Zfontsizeweightva)r   plotr   r   SimpleLineShadowr   titler   legendZlegendPatchZwithSimplePatchShadowtextr   Zget_bbox_patchPathPatchEffectZgcf)p1legrM   r"   tr#   r#   r$   test_patheffect3.   s:    

rR   zstroked_text.pngc               
   C   s   g d} d}t g d}t| D ]L\}}|jdd|d  |dd|d	d
d}|tj|d ddt g q"|dd |	dd |
d d S )N)z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   r   r   g{Gz?g?gp=
ף?leftr   r8   )r   rH   r   r;   )xysZfontdict
   rD   r   r   r   off)r   Zaxes	enumeraterM   r   r   r   r   set_xlimset_ylimaxis)Ztext_chunksZ	font_sizeaxichunkrM   r#   r#   r$   test_patheffects_stroked_textJ   s"    	ra   c                  C   sh   t jdd} t td\}|t t g | j	 }t
| |}|d|dksdJ d S )N   )ZdpirX      )r   ZfigurerI   ranger   r   rJ   r   ZcanvasZget_rendererZPathEffectRendererZget_path_effectsZpoints_to_pixels)figrO   rendererZpe_rendererr#   r#   r$    test_PathEffect_points_to_pixelsf   s    

rg   c                  C   s   t jdd} | jdksJ d S )N)r5   r   )rB   )r   ZSimplePatchShadow_offset)r"   r#   r#   r$   test_SimplePatchShadow_offsets   s    ri   
collectiongQ?)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   rX   rb   r   d   rD   none   )rE   rC   r   )r   r8   r*   r)   r   )r   r   Zsawtoothr?   )r:   rC   rE   )r.   meshgridlinspacesincosr   r/   r   rN   r   r1   r   r2   r   Zset_bbox)rU   rV   datacsr"   rj   rM   r#   r#   r$   test_collectionx   s"    $




rv   ZtickedstrokeZpngg)\(?)r   
extensionsrk   c               	   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   )ro   r5   )Zfigsizern   r   irX   )anglespacinglength)rC   r   r   equalr          )ry   rx   )labelr   e   r
   r	   g333333?   g?i   gMbP?g      @g      @r5   g?r>   )r)   r*   )rx   r,   )r6   <   )rx   rz   )b)ry   )r   Zsubplotsr   Zunit_circlepatchesZ	PathPatchr   ZwithTickedStrokeZ	add_patchr]   r[   r\   rI   r.   rq   rr   rL   rp   r/   r0   r1   )re   r    r3   Zax3pathpatchnxrU   rV   nyZxvecZyvecx1Zx2g1g2Zg3Zcg1Zcg2Zcg3r#   r#   r$   test_tickedstroke   sV    


r   zspaces_and_newlines.pngc               	   C   sl   t  } d}d}| jdd|dddddid	}| jdd
|dddddid	}|t g |t g d S )Nz	         z
Newline also causes problemsg      ?g      ?r   r   r;   Zsalmon)r   rH   r   r<   g      ?Zthistle)r   r   rM   r   r   r   )r^   s1s2Ztext1Ztext2r#   r#   r$   $test_patheffects_spaces_and_newlines   s    r   )numpyr.   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.patheffectsZpatheffectsr   Zmatplotlib.pathr   Zmatplotlib.patchesr   r%   r4   rR   ra   rg   ri   rv   r   r   r#   r#   r#   r$   <module>   s.   





5