o
    i\                     @   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 Z	dd Z
dd Zd	d
 Zdd Zdd Zedgdddd Zdd Zdd ZdS )    N)image_comparisonc           
   	   C   s   t t| t| ttd||gD ]8\\}}\}}\}\}}	||kr$qt| d d||||	||f ksJJ d|||	||f rDd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.
    xyr   z_shared_{}_axesz,axes %i and %i incorrectly %ssharing %s axisznot  N)	itertoolsproduct	enumeratezipgetattrformatjoined)
axsx_sharedy_sharedi1ax1i2ax2i3nameshared r   Y/var/www/edux/Edux_v2/venv/lib/python3.10/site-packages/matplotlib/tests/test_subplots.pycheck_shared
   s   
r   c                 C   s   t t| ||D ]A\}\}}}| | jg D ]}| |ks+J d| d| q| | jg D ]}| |ksHJ d| d| q6qd S )NzVisibility of x axis #z is incorrectly zVisibility of y axis #)r   r   get_xticklabels	get_xaxis
offsetTextget_visibleget_yticklabels	get_yaxis)r   	x_visible	y_visibleiaxvxvylr   r   r   check_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| qqtjddd
d
d\}\\}}\}}||||g}|D ]}|
  qt	|g d	g d d S )N)   r'      r(   )dtype)FTFF)TFFF)FFFT)FFTF)allnonerowcol)FFTTTr'   )r*   r-   r,   r+   FT)TFTF)xyr+   Fr*   )FTr*   r+   r,   r-   sharexshareyr.   r/   )nponesboolzerosarraypltsubplotsr   closer&   label_outer)rdimsharevisiblefa1a2a3a4r   opsxoyor"   r   r   r   test_shared&   sf   	
""
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(      )rI   r(   )r(   rI   )FTFT)TTFF)r8   figureadd_gridspecadd_subplotaxesr;   r&   )figgsr@   rA   rB   rC   r"   r   r   r   test_label_outer_spanc   s   

rP   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 )NrI   r(   Tr2   Fr1   )r8   r9   r&   yaxis	tick_leftxaxistick_bottom)r?   r@   rA   r   r   r   test_shared_and_movedw   s   

rW   c                	   C   s  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    n1 s5w   Y  t jtdd$ t t tddd W d    n1 sYw   Y  W d    n1 shw   Y  t jtdd$ t t tddd W d    n1 sw   Y  W d    n1 sw   Y  t jtdd- t t tddd	 W d    n1 sw   Y  W d    d S W d    d S 1 sw   Y  d S )
Nr(   blahrR   rQ   z.*sharex argument to subplots)matchr      )pytestraises
ValueErrorr8   r9   warnsUserWarningr   r   r   r   test_exceptions   s2     Pra   subplots_offset_textF)remove_textc                  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*   r0   )r   r   )rI   r   )r   rI   )rI   rI   )r3   aranger8   r9   plot)r.   r/   rN   r   r   r   r   test_subplots_offsettext   s   rh   c                  C   s(   t  \} }|  | ksJ d S )N)r8   r9   get_subplotspecget_gridspec)rN   r"   r   r   r   test_get_gridspec   s   rk   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 )Nr1   r*   width_ratiosrI   r(   )
subplot_kwgridspec_kw)r8   r9   )rm   rn   rN   r"   r   r   r   test_dont_mutate_kwargs   s   

ro   )r   numpyr3   r\   matplotlib.pyplotpyplotr8   matplotlib.testing.decoratorsr   r   r&   rG   rP   rW   ra   rh   rk   ro   r   r   r   r   <module>   s    
=

