o
    gC                     @   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)Path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->angle3)
arrowstyleconnectionstylelw   centerw	linewidth
foreground)
arrowpropssizehapath_effects   T-)	linestyler   )pltsubplotimshowannotatedictr   
withStrokearrow_patchset_path_effectsStrokeNormalgrid)ax1txtpe r+   _/home/ubuntu/cloudmapper/venv/lib/python3.10/site-packages/matplotlib/tests/test_patheffects.pytest_patheffect1
   s$   
r-   patheffect2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   nearest)interpolationkcolorsr   r   r   r   z%2.0fT)fmtuse_clabeltext)r   r   nparangereshaper   contoursetpcollectionsr   r"   clabel)ax2arrcntrclblsr+   r+   r,   test_patheffect2   s   
rE   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-brG   )r   ztesting$^{123}$r   rr   r7   z
Line 1$^2$Tz
upper left)fancyboxlocr   r   z	Drop testwhitezcircle,pad=0.1red)boxstylecolor)rN   bboxg      @r4   )   blue)shadow_rgbFace)rG   xxxxgray)offsethatch	facecolorblackg?)	edgecolorrY   r   g{Gz?g?zHatch shadowK   i  r   )fontsizeweightva)r   plotr$   r   SimpleLineShadowr&   titler"   legendlegendPatchwithSimplePatchShadowtextr%   get_bbox_patchPathPatchEffectgcf)p1legrf   r*   tr+   r+   r,   test_patheffect3.   s:   

rm   zstroked_text.pngc               
   C   s   g d} d}t g d}t| D ]&\}}|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   rK   )r   r_   r   rN   )xysfontdict
   rZ   r   r   r   off)r   axes	enumeraterf   r$   r   r%   r&   set_xlimset_ylimaxis)text_chunks	font_sizeaxichunkrf   r+   r+   r,   test_patheffects_stroked_textJ   s"   	r   c                  C   sh   t jdd} t td\}|t t g | j	 }t
| |}|d|dks2J d S )N   )dpirt      )r   figurer`   ranger$   r   ra   r&   canvasget_rendererPathEffectRendererget_path_effectspoints_to_pixels)figrj   rendererpe_rendererr+   r+   r,    test_PathEffect_points_to_pixelsf   s   

r   c                  C   s   t jdd} | jdksJ d S )N)rG   r   )rW   )r   SimplePatchShadow_offset)r*   r+   r+   r,   test_SimplePatchShadow_offsets   s   r   
collectiongQ?)tolr0   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 ]}|| q2tj|ddD ]}|tjdddg |dddd qAd S )Nr   rt   r   r   d   rZ   none   )r[   rY   r   )r   rK   r5   r4   r   )r   r   sawtoothrR   )rM   rY   r[   )r:   meshgridlinspacesincosr   r=   r   rh   r%   r?   r$   r@   r"   set_bbox)rp   rq   datacsr*   r   rf   r+   r+   r,   test_collectionx   s$   $





r   tickedstroke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   )r   rG   )figsizer   r   irt   )anglespacinglength)rY   r   r   equalr          )r   r   )labelr   e   r   r
   g333333?   g?i   gMbP?g      @g      @rG   g?rQ   )r4   r5   )r   r7   )rH   <   )r   r   )b)r   )r   subplotsr   unit_circlepatches	PathPatchr   withTickedStroke	add_patchrz   rx   ry   r`   r:   r   r   rc   r   r=   r>   r?   )r   r(   rA   ax3pathpatchnxrp   rq   nyxvecyvecx1x2g1g2g3cg1cg2cg3r+   r+   r,   test_tickedstroke   sV   


r   )numpyr:   matplotlib.testing.decoratorsr   matplotlib.pyplotpyplotr   matplotlib.patheffectspatheffectsr   matplotlib.pathr   matplotlib.patchesr   r-   rE   rm   r   r   r   r   r   r+   r+   r+   r,   <module>   s(    




