o
    lib                     @   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)classic_classic_test_patch)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
projection
subplot_kw
      oyzz=1)zdirlabelzz=-1)pltsubplotsdictnparangeplotlegend)figaxx r   f/home/ubuntu/SoloSpeech/.venv/lib/python3.10/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colorr   gr   up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)xerrzerrr   z
lower left   z	My legend   )locncolstitle	numpoints)
r   r   r   r   r   r   fullr.   r0   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 qud S )N)r   r/   )r/   r4   )g333333?333333?)皙?r<   gffffff?r<   g?g?r/   r;   g?z--   )
linestyleslwz-.)r>   :r	   r
   r   )line1line2zline 3r   )r   Line3DCollectionr   r   r   add_collectionr   legend_handleszipget_linestyles_dash_pattern)lines1lines2lines3lc1lc2lc3r   r   legh1h2h3ohlhr   r   r   !test_linecollection_scaled_dashes,   s     


rU   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s<J d S )
Nr	   r
   r   r   r4   v)markerAardvark)r8   )	r   r   r   r.   r   Line3Dr   
get_markerrE   )r   r   handlesrO   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sAJ t	 fdd|D sNJ t	dd t
||D s\J d S )Nr   LineCollectionr4   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       | ]}t | V  qd S N
isinstance.0ar]   r   r   	<genexpr>T       z/test_contour_legend_elements.<locals>.<genexpr>c                 s   "    | ]\}}t | |V  qd S rj   )r   	get_colorrn   ro   cr   r   r   rp   U       )matplotlib.collectionsr^   r   mgridr   r   r   contourlegend_elementsallrF   )	r   r   hrg   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sOJ d}t fdd|D s^J tdd t||D slJ d S )Nr   	Rectangler4   r   r	   r
   r   ra   )#FFFF00#FF00FFz#00FFFFrd   re   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   ri   rj   rk   rm   r   r   r   rp   k   rq   z0test_contourf_legend_elements.<locals>.<genexpr>c                 s   rr   rj   )r   get_facecolorrt   r   r   r   rp   l   rv   )matplotlib.patchesr   r   rx   r   r   r   contourfcmapset_over	set_underchangedrz   r{   rF   )	r   r   r|   r   r   r}   r~   r   expected_colorsr   r   r   test_contourf_legend_elementsY   s$   r   )numpyr   matplotlib.colorsr   matplotlib.testing.decoratorsr   matplotlib.pyplotpyplotr   mpl_toolkits.mplot3dr   r    r,   r:   rU   r\   r   r   r   r   r   r   <module>   s*   
	
	
		