a
    
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   q/var/www/html/stable-diffusion-webui/venv/lib/python3.9/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   Zedgem)r   Zaligncolorr   gr   Z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    *  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g d}|j\}	}
}t|||f|	|
|fD ]\}}|	 d |j
ksJ qd S )N)r   r&   )r&   r)   )g333333?333333?)皙?r0   gffffff?r0   g?g?r&   r/   g?z--   )
linestylesZlwz-.)r2   :r   r   r   )Zline1Zline2zline 3r   )r   ZLine3DCollectionr   r   r   Zadd_collectionr   legend_handleszipZget_linestylesZ_dash_pattern)Zlines1Zlines2Zlines3Zlc1Zlc2Zlc3r   r   legh1h2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sxJ d S )
Nr   r   r   r   r)   v)markerZAardvark)r,   )	r   r   r   r%   r   ZLine3Dr   Z
get_markerr4   )r   r   Zhandlesr6   r   r   r   test_handlerline3d@   s
    r=   c            	         s   ddl m  tjddddf \} }| | }g d}tjtddd\}}|j| ||g d	|d
d}| \}}|g dksJ t	 fdd|D sJ t	dd t
||D sJ d S )Nr   LineCollectionr)   r	   )bluez#00FF00redr   r   r   r	      2   bothlevelscolorsextend)z
$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       z/test_contour_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | |V  qd S rJ   )r   Z	get_colorrN   rO   cr   r   r   rP   U   s   )Zmatplotlib.collectionsr?   r   mgridr   r   r   Zcontourlegend_elementsallr5   )	r   r   hrH   r   r   csartistslabelsr   r>   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| ||g dg d	d
d}|j	d |j
d |  | \}}|g dksJ d}t fdd|D sJ tdd t||D sJ d S )Nr   	Rectangler)   r	   r   r   r   rB   )#FFFF00#FF00FFz#00FFFFrE   rF   rA   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_   rA   c                 3   s   | ]}t | V  qd S rJ   rK   rM   r\   r   r   rP   k   rQ   z0test_contourf_legend_elements.<locals>.<genexpr>c                 s   s    | ]\}}t | |V  qd S rJ   )r   Zget_facecolorrR   r   r   r   rP   l   s   )Zmatplotlib.patchesr]   r   rT   r   r   r   ZcontourfZcmapZset_overZ	set_underchangedrU   rV   r5   )	r   r   rW   r   r   rX   rY   rZ   Zexpected_colorsr   r\   r   test_contourf_legend_elementsY   s$    ra   )numpyr   Zmatplotlib.colorsr   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr   Zmpl_toolkits.mplot3dr   r   r#   r.   r:   r=   r[   ra   r   r   r   r   <module>   s(   
	
	
		