U
    ƒi2eb  ã                   @   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   úL/tmp/pip-unpacked-wheel-qhyxngld/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   ZedgeÚm)r   ZalignÚcoloréÿÿÿÿr   Úgr   ZupZdown)r   r   r   r   r   Úbarr   )r   r   r   Zb1Z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    *    ÿr,   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ã?)çš™™™™™É?r.   gffffffæ?r.   gš™™™™™é?gš™™™™™Ù?r$   r-   gš™™™™™¹?z--é   )Ú
linestylesZlwz-.)r0   ú:r   r   r   Zline1Z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   ÚlegÚh1Úh2Úh3ZohZlhr   r   r   Ú!test_linecollection_scaled_dashes,   s      


r9   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_markerr2   r4   )r   r   Zhandlesr5   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©Ú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Úar=   r   r   Ú	<genexpr>T   s     z/test_contour_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | ¡ |ƒV  qd S rH   )r   Z	get_color©rL   rM   Úcr   r   r   rN   U   s   ÿ)Zmatplotlib.collectionsr>   r   Úmgridr   r   r   ZcontourÚlegend_elementsr4   Úallr3   )	r   r   ÚhrF   r   r   ÚcsÚartistsÚlabelsr   r=   r   Útest_contour_legend_elementsI   s    
ÿrX   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   rA   rB   ú#FFFF00ú#FF00FFz#00FFFFrC   rD   r@   r?   z$x \leq -1e+250s$z$10.0 < x \leq 30.0$z$30.0 < x \leq 50.0$z$x > 1e+250s$)r?   r[   r\   r@   c                 3   s   | ]}t |ˆ ƒV  qd S rH   rI   rK   rY   r   r   rN   k   s     z0test_contourf_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | ¡ |ƒV  qd S rH   )r   Zget_facecolorrO   r   r   r   rN   l   s   ÿ)Zmatplotlib.patchesrZ   r   rQ   r   r   r   ZcontourfZcmapZset_overZ	set_underÚchangedrR   r4   rS   r3   )	r   r   rT   r   r   rU   rV   rW   Zexpected_colorsr   rY   r   Útest_contourf_legend_elementsY   s,    þý
ÿr^   )Znumpyr   Zmatplotlib.colorsr   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmpl_toolkits.mplot3dr   r   r!   r,   r9   r<   rX   r^   r   r   r   r   Ú<module>   s(   ÿ
	ÿ
	ÿ
		