o
    -h                     @   s   d dl Z d dlZ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e  dkrId ndddd Z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mpl20)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   \/var/www/vscode/kcb/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.pngx86_64gI+?)r   r   tolc                  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   fullr0   r2   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   r1   )r1   r6   )g333333?333333?)皙?r>   gffffff?r>   g?g?r1   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     


rW   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   r6   v)markerAardvark)r:   )	r   r   r   r0   r   Line3Dr   
get_markerrG   )r   r   handlesrQ   r   r   r   test_handlerline3d=   s
   "r^   c            	      C   s   t jddddf \} }| | }g d}tjtddd\}}|j| ||g d|dd	}| \}}|g d
ks;J tdd |D sFJ tdd t||D sTJ d S )Nr6   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                 s       | ]
}t |tjjV  qd S N)
isinstancempllinesLine2D.0ar   r   r   	<genexpr>P       z/test_contour_legend_elements.<locals>.<genexpr>c                 s   "    | ]\}}t | |V  qd S rj   )r   	get_colorrp   rq   cr   r   r   rr   Q       )	r   mgridr   r   r   contourlegend_elementsallrH   )	r   r   hrg   r   r   csartistslabelsr   r   r   test_contour_legend_elementsF   s   r   c            	      C   s   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sIJ d}tdd |D sVJ tdd t||D sdJ d S )Nr6   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                 s   ri   rj   )rk   rl   patches	Rectanglero   r   r   r   rr   f   rs   z0test_contourf_legend_elements.<locals>.<genexpr>c                 s   rt   rj   )r   get_facecolorrv   r   r   r   rr   g   rx   )r   ry   r   r   r   contourfcmapset_over	set_underchangedr{   r|   rH   )	r   r   r}   r   r   r~   r   r   expected_colorsr   r   r   test_contourf_legend_elementsU   s"   r   c                  C   s~   t g dg dg dg} tj| gdd}tjddid\}}|d	 ||}| }|j	d
 
 |
 k s=J d S )N)r   r   r   )r   r6   r6   )r6   r   r6   surfacer/   r
   r   r   kr   )r   asarrayr   Poly3DCollectionr   r   set_edgecoloradd_collection3dr   rG   r   r|   )vertsmeshr   r   handlerQ   r   r   r   test_legend_Poly3dCollectionk   s   


r   )platformnumpyr   
matplotlibrl   matplotlib.colorsr   matplotlib.testing.decoratorsr   matplotlib.pyplotpyplotr   mpl_toolkits.mplot3dr   r   r+   machiner<   rW   r^   r   r   r   r   r   r   r   <module>   s(    



		