o
    jJ+                     @   s*  d dl Z d dlZd dlZd dlZd dlZd dlmZm	Z	 d dl
mZ d dlmZmZ dd Zdd Zdd	 Zd
d Zejdddgejdg dejdddgdd Zdd Zdd Zdd Zdd Zedge dkrtd nddd d! Zejd"ddgejd#ddgejd$ddgejd%ddgd&d' Zejd(d#d"gejd)d$d%gd*d+ Zd,d- Zd.d/ Z ejd0dg d1gejd2dd3d4gged5gd6d7d8 Z!ejd0dg d1gejd2dd3d4gged5gd6d9d: Z"ejd;d<d=gd>d? Z#d@dA Z$dS )B    N)AxesSubplotBase)check_figures_equalimage_comparisonc           
   	   C   s   t t| t| ttd||gD ]5\\}}\}}\}\}}	||kr$q| d j| |||	||f ksGJ d|||	||f rAdnd|f qdS )z
    x_shared and y_shared are n x n boolean matrices; entry (i, j) indicates
    whether the x (or y) axes of subplots i and j should be shared.
    Zxyr   z,axes %i and %i incorrectly %ssharing %s axisznot  N)	itertoolsproduct	enumeratezipZ_shared_axesZjoined)
axsZx_sharedZy_sharedi1Zax1i2Zax2Zi3nameZshared r   _/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/matplotlib/tests/test_subplots.pycheck_shared   s   $r   c                 C   s   t t| ||D ]S\}\}}}| |jjg D ]}| |ks*J d| d| q| |jjg D ]}| |ksFJ d| d| q4|sQ| dksQJ |s[|	 dks[J qdS )z<Check that the x and y ticklabel visibility is as specified.zVisibility of x axis #z is incorrectly zVisibility of y axis #r   N)
r	   r
   Zget_xticklabelsxaxisZ
offsetTextget_visibleZget_yticklabelsyaxis
get_xlabel
get_ylabel)r   	x_visible	y_visibleiaxZvxZvylr   r   r   check_ticklabel_visible   s   r   c                 C   sp   t | |D ]\}}|j D ]}|j |ksJ qqt | |D ]\}}|j D ]}|j |ks4J q)q dS )z
    Check that the x and y tick visibility is as specified.

    Note: This only checks the tick1line, i.e. bottom / left ticks.
    N)r
   r   Zget_major_ticksZ	tick1liner   r   )r   r   r   r   visibleZtickr   r   r   check_tick1_visible.   s   r   c               
   C   s  d} t j| d d tdt j| d d tdt g dg dg dg dgt g dg dg dg dgd}g d	g d	d
gd d
gd d
gd g d	dg dd
gd g dd
gd d
gd g ddd}|d |d< |d |d
< tdd\}\\}}\}}||||g}t||d |d  t| g d}	|	D ];}
|	D ]6}tjdd|
|d\}\\}}\}}||||g}t|||
 ||  t	||d |
 |d |  t| qqd S )N)   r      r    )Zdtype)FTFF)TFFF)FFFT)FFTF)allnonerowcolFFTTTr   )r!   r$   r#   r"   FTTFTF)xyr"   Fr!   )FTr!   r"   r#   r$   r      sharexshareyr'   r(   )
npZonesboolZzerosarraypltsubplotsr   closer   )ZrdimZsharer   fa1a2a3a4r   opsZxoZyor   r   r   test_shared<   s^   	
"r9   remove_ticksTFlayout_engine)r"   ZtightZconstrainedwith_colorbarc                 C   s   t j|d}|jddddd}|jD ]}|jddd |r'|jtj |d |j	| d	 qt
|jg d
g d | rHt|jg d
g d d S t|jg dg d d S )N)Zlayoutr    Tr*   foobarZxlabelZylabelr   )Zremove_inner_ticksr%   r&   )TTTT)r0   figurer1   ZflatsetZcolorbarmplcmZScalarMappablelabel_outerr   r   )r:   r;   r<   figr   r   r   r   r   test_label_outerr   s"   
rG   c                  C   s   t  } | dd}| |dddf }| |dddf }| |d }| |d }| jD ]}|  q1t| jg dg d d S )	N   r   r    r)   )r)   r    )r    r)   )FTFT)TTFF)r0   rA   Zadd_gridspecadd_subplotaxesrE   r   )rF   gsr4   r5   r6   r7   r   r   r   r   test_label_outer_span   s   

rL   c                  C   s(   t d} |   t| gdgdg d S )Nr   r   r)   r)   T)r0   rJ   rE   r   r@   r   r   r   test_label_outer_non_gridspec   s   
rN   c                  C   s   t jdddd\} \}}t|gdgdg |j  t|gdgdg t jdddd\} \}}t|gdgdg |j  t|gdgdg d S )Nr)   r    Tr,   Fr+   )r0   r1   r   r   Z	tick_leftr   Ztick_bottom)r3   r4   r5   r   r   r   test_shared_and_moved   s   

rQ   c                   C   sz   t t tjdddd W d    n1 sw   Y  t t tjdddd W d    d S 1 s6w   Y  d S )Nr    ZblahrP   rO   )pytestraises
ValueErrorr0   r1   r   r   r   r   test_exceptions   s   "rU   zsubplots_offset_text.pngx86_64gy&1?)Ztolc                  C   sz   t ddd} t dddd }tjdddd	d
\}}|d | |  |d | |  |d ||  |d ||  d S )Nr   g    _Bg    eAd   
   g     @r    r$   r!   r*   )r   r   )r)   r   )r   r)   )r)   r)   )r-   Zaranger0   r1   Zplot)r'   r(   rF   r   r   r   r   test_subplots_offsettext   s   rY   topbottomleftrightc                 C   s   t | |||d t  jddddd}W d    n1 s w   Y  t|D ]F\\}}}|jjd }|jjd }	|jjd }
|jjd }|| oN|dkksRJ |	|oX|dkks\J |
|ob|dkksfJ ||ol|dkkspJ q*d S )	N)zxtick.labeltopzxtick.labelbottomzytick.labelleftzytick.labelrightrH   Tr*   Zlabel2OnZlabel1Onr   r    )	r0   Z
rc_contextrA   r1   r-   ndenumerater   Z_major_tick_kwr   )rZ   r[   r\   r]   r   r   jr   ZxtopZxbottomZyleftZyrightr   r   r   test_subplots_hide_ticklabels   s   
r`   xlabel_positionylabel_positionc                 C   s   t  jddddd}t|D ]M\\}}}|jddd |j|  |j| |	  t
| | dkr:|dkpA| d	koA|d
kksEJ t
| |dkrR|d
kpY|dkoY|dkks]J qd S )NrH   Tr*   r=   r>   r?   r[   r    rZ   r   r\   r]   )r0   rA   r1   r-   r^   rB   r   Zset_label_positionr   rE   r.   r   r   )ra   rb   r   r   r_   r   r   r   r   test_subplots_hide_axislabels   s   


rc   c                  C   s(   t  \} }|  | ksJ d S )N)r0   r1   Zget_subplotspecZget_gridspec)rF   r   r   r   r   test_get_gridspec   s   rd   c                  C   sR   ddi} dddgi}t jdd| |d\}}| ddiksJ |dddgiks'J d S )Nr+   r!   width_ratiosr)   r    )
subplot_kwgridspec_kw)r0   r1   )rf   rg   rF   r   r   r   r   test_dont_mutate_kwargs   s   

rh   re   )r)   rH   r    height_ratiosr)   r    Zpng)
extensionsc                 C   s,   | j dd||d |j dd||dd d S )Nr    rH   ri   re   rg   )r1   )fig_testfig_refri   re   r   r   r   test_width_and_height_ratios   s   
ro   c                 C   s8   g dg dg}| j |||d |j |||dd d S )N)ABrq   )rp   CDrk   rl   )subplot_mosaic)rm   rn   ri   re   Zmosaic_specr   r   r   #test_width_and_height_ratios_mosaic  s   ru   zmethod,args)r1   )r    rH   )rt   )zabc;defc                 C   s   t jtdd tt| |ddgdddgid W d    n1 s#w   Y  t jtdd tt| |g ddg did W d    d S 1 sLw   Y  d S )	Nri   )matchr)   r    )ri   rg   re   )r)   r    rH   )re   rg   )rR   rS   rT   getattrr0   )methodargsr   r   r   test_ratio_overlapping_kws  s   



"rz   c                  C   sz   t  } t|  tsJ t| jg ddtrJ tt t	| g dg dd W d    d S 1 s6w   Y  d S )NrM   )rect)
r0   rA   
isinstancerI   r   Zadd_axesrR   rS   	TypeErrorr   )rF   r   r   r   test_old_subplot_compat   s   "r~   )%r   platformnumpyr-   rR   Z
matplotlibrC   Zmatplotlib.axesr   r   Zmatplotlib.pyplotZpyplotr0   Zmatplotlib.testing.decoratorsr   r   r   r   r   r9   markZparametrizerG   rL   rN   rQ   rU   machinerY   r`   rc   rd   rh   ro   ru   rz   r~   r   r   r   r   <module>   s`    6

	
	


	