U
    Âmœdb  ã                   @   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
 edgdddd	d
„ ƒZedgddddd„ ƒZedgddddd„ ƒZdd„ Zdd„ Zdd„ Zdd„ ZdS )é    N)Ú
same_color)Úimage_comparison)Úart3dzlegend_plot.pngT)ZclassicZ_classic_test_patch)Zremove_textÚstylec                  C   s\   t jtddd\} }t d¡}|j|d| dddd	 |j||d ddd
d	 | ¡  d S )NÚ3d©Z
projection©Z
subplot_kwé
   é   ÚoÚyzz=1)ÚzdirÚlabelzz=-1)ÚpltÚsubplotsÚdictÚnpÚarangeÚplotÚlegend)ÚfigÚaxÚx© r   úa/home/sam/Atlas/atlas_env/lib/python3.8/site-packages/mpl_toolkits/mplot3d/tests/test_legend3d.pyÚtest_legend_plot   s
    
r   zlegend_bar.pngc                  C   sr   t jtddd\} }t d¡}|j||dddd}|j||d d d	… d
ddd}| |d |d gddg¡ d S )Nr   r   r   r	   r   ÚedgeÚm)r   ÚalignÚcoloréÿÿÿÿr   Úgr   ÚupZdown)r   r   r   r   r   Úbarr   )r   r   r   Úb1Úb2r   r   r   Útest_legend_bar   s
    
r&   z	fancy.pngc                  C   s¢   t jtddd\} }|jt d¡t dd¡t dd¡ddd |jt d¡t dd	d
¡dd |jt dd¡t d¡t dd¡dddd |j	ddddd d S )Nr   r   r   r	   r
   zo--Úline)r   r   r    Úscatterç      à?Úerrorbar)ZxerrZzerrr   z
lower lefté   z	My legendé   )ÚlocZncolsÚtitleÚ	numpoints)
r   r   r   r   r   r   Úfullr(   r*   r   )r   r   r   r   r   Ú
test_fancy!   s    *    ÿr1   c                  C   s  ddgddgg} ddgddggd	dgd
dggg}d
dgddggd	dgddggg}t j| ddd}t j|dd}t j|dd	d}tjtddd\}}| |¡ | |¡ | |¡ | |||gdddg¡}|j\}	}
}t|||f|	|
|fƒD ]\}}| 	¡ d |j
ksìt‚qìd S )N)r   r)   )r)   r,   )g333333Ó?ç333333ã?)çš™™™™™É?r3   gffffffæ?r3   gš™™™™™é?gš™™™™™Ù?r)   r2   gš™™™™™¹?z--é   )Ú
linestylesZlwz-.)r5   ú:r   r   r   Úline1Úline2zline 3r   )r   ZLine3DCollectionr   r   r   Zadd_collectionr   Úlegend_handlesÚzipZget_linestylesZ_dash_patternÚAssertionError)Zlines1Zlines2Zlines3Zlc1Zlc2Zlc3r   r   ÚlegZh1Zh2Zh3ZohZlhr   r   r   Ú!test_linecollection_scaled_dashes,   s      


r=   c                  C   s|   t jtddd\} }|jddgddgdd tjdgdgdgddg}|j|dgdd	}|d  ¡ |jd  ¡ ksxt	‚d S )
Nr   r   r   r   r,   Úv)ÚmarkerZAardvark)r/   )
r   r   r   r(   r   ZLine3Dr   Z
get_markerr9   r;   )r   r   Zhandlesr<   r   r   r   Útest_handlerline3d@   s
    r@   c            	         sÂ   ddl m‰  tjdd…dd…f \} }| | }dddg}tjtdd	d
\}}|j| ||dddg|dd}| ¡ \}}|dddgksˆt	‚t
‡ fdd„|D ƒƒs¢t	‚t
dd„ t||ƒD ƒƒs¾t	‚d S )Nr   ©ÚLineCollectionr,   r	   Úbluez#00FF00Úredr   r   r   é   é2   Úboth©ZlevelsÚcolorsÚextendz
$x = 10.0$z
$x = 30.0$z
$x = 50.0$c                 3   s   | ]}t |ˆ ƒV  qd S ©N©Ú
isinstance©Ú.0ÚarA   r   r   Ú	<genexpr>T   s     z/test_contour_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | ¡ |ƒV  qd S rK   )r   Ú	get_color©rO   rP   Úcr   r   r   rQ   U   s   ÿ)Zmatplotlib.collectionsrB   r   Úmgridr   r   r   ZcontourÚlegend_elementsr;   Úallr:   )	r   r   ÚhrI   r   r   ÚcsÚartistsÚlabelsr   rA   r   Útest_contour_legend_elementsI   s    
ÿr\   c            	         sä   ddl m‰  tjdd…dd…f \} }| | }tjtddd\}}|j| ||ddd	gd
ddgdd}|j 	d¡ |j 
d¡ | ¡  | ¡ \}}|ddddgks¦t‚d}t‡ fdd„|D ƒƒsÄt‚tdd„ t||ƒD ƒƒsàt‚d S )Nr   ©Ú	Rectangler,   r	   r   r   r   rE   rF   ú#FFFF00ú#FF00FFz#00FFFFrG   rH   rD   rC   z$x \leq -1e+250s$z$10.0 < x \leq 30.0$z$30.0 < x \leq 50.0$z$x > 1e+250s$)rC   r_   r`   rD   c                 3   s   | ]}t |ˆ ƒV  qd S rK   rL   rN   r]   r   r   rQ   k   s     z0test_contourf_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | ¡ |ƒV  qd S rK   )r   Zget_facecolorrS   r   r   r   rQ   l   s   ÿ)Zmatplotlib.patchesr^   r   rU   r   r   r   ZcontourfZcmapZset_overZ	set_underÚchangedrV   r;   rW   r:   )	r   r   rX   r   r   rY   rZ   r[   Zexpected_colorsr   r]   r   Útest_contourf_legend_elementsY   s,    þý
ÿrb   )Únumpyr   Zmatplotlib.colorsr   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmpl_toolkits.mplot3dr   r   r&   r1   r=   r@   r\   rb   r   r   r   r   Ú<module>   s(   ÿ
	ÿ
	ÿ
		