o
    ÕjÎ^  ã                
   @   sv  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 d dl	m
Z d dlmZ d dlmZmZ ej d¡gZdŒdd„Zdd	d
„Zedgdddd„ ƒZedgdddd„ ƒZedgdddd„ ƒZedgdddd„ ƒZedgdddd„ ƒZedgdddd„ ƒZdd „ Zd!d"„ Zed#gddd$d%„ ƒZed&gddd'd(„ ƒZed)gde  ¡ d*kr«d nd+d,d-d.„ ƒZ!ed/gddd0d1„ ƒZ"ed2gddd3d4„ ƒZ#ed5gddd6d7„ ƒZ$ed8gddd9d:„ ƒZ%ed;gddd<d=„ ƒZ&ed>gddd?d@„ ƒZ'edAgdddBdC„ ƒZ(edDgdddEdF„ ƒZ)dGdH„ Z*dIdJ„ Z+dKdL„ Z,dMdN„ Z-dOdP„ Z.dQdR„ Z/edSgdTddUdVdW„ ƒZ0dXdY„ Z1dZd[„ Z2ed\gddd]d^„ ƒZ3ed_gddd`da„ ƒZ4dbdc„ Z5eddgdTddedfidgdhdi„ ƒZ6edjgdTddee 7dkd gdldmgg¡idgdndo„ ƒZ8dpdq„ Z9drds„ Z:dtdu„ Z;dvdw„ Z<dxdy„ Z=dzd{„ Z>d|d}„ Z?d~d„ Z@ej Ad€dd‚i dTfdƒdidTfg¡d„d…„ ƒZBd†d‡„ ZCdˆd‰„ ZDdŠd‹„ ZEdS )Žé    N)Úimage_comparison)ÚgridspecÚtickerZtext_placeholdersé   Fc                 C   sd   |   ddg¡ | jdd |s&| jd|d | jd|d | jd|d d S |  g ¡ |  g ¡ d S )	Né   é   é   ©Znbinsúx-label©Úfontsizeúy-labelÚTitle)ÚplotZlocator_paramsÚ
set_xlabelÚ
set_ylabelÚ	set_titleÚset_xticklabelsÚset_yticklabels)Úaxr   Únodec© r   úh/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/matplotlib/tests/test_constrainedlayout.pyÚexample_plot   s   
r   c              	   C   s¼   d\}}t jtdd| |ƒtdd| |ƒf \}}d|d  |d  |d  t  |d  |d  ¡ }| j|||d d…d d…f d	d
ddd}| jd|d | jd|d | jd|d |S )N)ç333333ã?r   éýÿÿÿr   r   ç       @é   r   éÿÿÿÿZRdBu_rg      ð¿ç      ð?T)ZcmapZvminZvmaxZ
rasterizedr
   r   r   r   )ÚnpZmgridÚsliceÚexpÚ
pcolormeshr   r   r   )r   r   ZdxZdyÚyÚxÚzÚpcmr   r   r   Úexample_pcolor   s   
ÿ4 ÿr(   zconstrained_layout1.pngZmpl20)Ústylec                  C   s$   t jdd} |  ¡ }t|dd dS )z,Test constrained_layout for a single subplotÚconstrained©Úlayouté   r   N)ÚpltÚfigureÚadd_subplotr   ©Úfigr   r   r   r   Útest_constrained_layout1,   s   r3   zconstrained_layout2.pngc                  C   s0   t jdddd\} }|jD ]}t|dd qdS )z(Test constrained_layout for 2x2 subplotsr   r*   r+   r-   r   N)r.   ÚsubplotsÚflatr   ©r2   Úaxsr   r   r   r   Útest_constrained_layout24   s   
ÿr8   zconstrained_layout3.pngc                  C   sZ   t jdddd\} }t|jƒD ]\}}t|dd}|dkr d}nd}| j|||d	 qd
S )z3Test constrained_layout for colorbars with subplotsr   r*   r+   r-   r   r   g{®Gáz´?ç{®Gáz”?)r   ÚpadN)r.   r4   Ú	enumerater5   r(   Úcolorbar)r2   r7   Únnr   r'   r:   r   r   r   Útest_constrained_layout3<   s   úr>   zconstrained_layout4.pngc                  C   sB   t jdddd\} }|jD ]}t|dd}q| j||ddd d	S )
z;Test constrained_layout for a single colorbar with subplotsr   r*   r+   r-   r   ç{®Gáz„?r   ©r   r:   ÚshrinkN©r.   r4   r5   r(   r<   ©r2   r7   r   r'   r   r   r   Útest_constrained_layout4J   s   
rD   zconstrained_layout5.pngc                  C   sF   t jdddd\} }|jD ]}t|dd}q| j||dddd	d
 dS )zZ
    Test constrained_layout for a single colorbar with subplots,
    colorbar bottom
    r   r*   r+   r-   r   Fr?   r   Úbottom)r   Zuse_gridspecr:   rA   ÚlocationNrB   rC   r   r   r   Útest_constrained_layout5T   s   

þrG   zconstrained_layout6.pngc               	   C   sÄ   t jdd} | jdd| d}|d  dd¡}|d  dd¡}g }|D ]}|  |¡}||g7 }t|dd q"| d	¡ g }|D ]}|  |¡}||g7 }t|dd}q>| j||d
ddt	j
ddd dS )z,Test constrained_layout for nested gridspecsr*   r+   r   r   ©r/   r   r   r   zx-label
MultiLiner?   g®Gáz®ï?rE   r   r	   )r   r:   rA   rF   ZticksN)r.   r/   Úadd_gridspecÚsubgridspecr0   r   r   r(   r<   r   ZMaxNLocator)r2   ÚgsÚgslÚgsrZaxslr   Zaxsrr'   r   r   r   Útest_constrained_layout6c   s&   






þrN   c                  C   s¢   t jdd} |  dd¡}|d  dd¡}|d  dd¡}g }g }tdƒD ]}||  || ¡g7 }||  || ¡g7 }q$|  ¡  |d  ¡ j|d  ¡ j	ksOJ ‚d S )NT©Úconstrained_layoutr   r   r   r   )
r.   r/   rI   rJ   Úranger0   Údraw_without_renderingÚget_positionÚy0Úy1)r2   ZGSZGSAZGSBZaxaZaxbÚir   r   r   Útest_identical_subgridspec{   s   $rW   c                  C   sŒ   t jtdd5 tjdd} t dd¡}t dd|d ¡}t dd|d ¡}|D ]}|  |¡ q(|  	¡  W d  ƒ dS 1 s?w   Y  dS )	z2Test for proper warning if fig not set in GridSpeczhThere are no gridspecs with layoutgrids. Possibly did not call parent GridSpec with the "figure" keyword©Úmatchr*   r+   r   r   r   N)
ÚpytestÚwarnsÚUserWarningr.   r/   r   ÚGridSpecÚGridSpecFromSubplotSpecr0   rR   )r2   rK   rL   rM   r   r   r   Útest_constrained_layout7   s   ÿ
"õr_   zconstrained_layout8.pngc                  C   sæ   t jddd} tjdd| d}g }dD ]>}|dkrd	g}ndd
g}|D ]-}|  |||f ¡}||g7 }t|dd |dkrB| d¡ |d	k rK| d¡ | d¡ q#q|  |ddd…f ¡}||g7 }t|dd}| j	||ddd dS )z/Test for gridspecs that are not completely full)é
   r   r*   ©Úfigsizer,   r   r   rH   ©r   r   r   r   é   é	   r   Ú r   Nr?   r   r@   )
r.   r/   r   r]   r0   r(   r   r   r   r<   )r2   rK   r7   ÚjZilistrV   r   r'   r   r   r   Útest_constrained_layout8Ÿ   s*   


ø	
rh   zconstrained_layout9.pngc                  C   sr   t jdddddd\} }|jD ]}t|dd}| d¡ | d¡ q| d¡ | j||d	d
d | jddd dS )z4Test for handling suptitle and for sharex and shareyr   r*   F©r,   ÚsharexÚshareyr-   r   rf   r   r?   r   r@   zTest Suptitleé   N)	r.   r4   r5   r(   r   r   Ú
set_aspectr<   ÚsuptitlerC   r   r   r   Útest_constrained_layout9»   s   

ÿ


ro   zconstrained_layout10.pngÚx86_64gü©ñÒMb ?)r)   Ztolc                  C   sF   t jdddd\} }|jD ]}|jt d¡dd q|jddd	 d
S )z%Test for handling legend outside axisr   r*   r+   r   zThis is a label)Úlabelzcenter left)gš™™™™™é?ç      à?)ÚlocZbbox_to_anchorN)r.   r4   r5   r   r    ZarangeZlegendr6   r   r   r   Útest_constrained_layout10Ê   s   
rt   zconstrained_layout11.pngc                  C   sº   t jddd} tjdd| d}t dd|d ¡}t dd|d ¡}|  |d ¡}t|dd	 g }|D ]}|  |¡}||g7 }t|dd	}q2| j||d
dd |  |d ¡}t|dd	 dS )z"Test for multiple nested gridspecsr*   )é   r   ©r,   rb   r   r   rH   r   re   r   r   ç     €Q@©r   rA   ÚaspectN©	r.   r/   r   r]   r^   r0   r   r(   r<   ©r2   Úgs0rL   Zgsl0r   r7   rK   r'   r   r   r   Útest_constrained_layout11Ô   s   

r}   zconstrained_layout11rat.pngc                  C   sÈ   t jddd} tjdd| ddgd}t dd|d ¡}tjdd|d ddgd	}|  |d ¡}t|d
d g }|D ]}|  |¡}||g7 }t|d
d}q9| j||ddd |  |d ¡}t|d
d dS )z4Test for multiple nested gridspecs with width_ratiosr*   )r`   r   rv   r   r   é   )r/   Zwidth_ratiosr   )Úheight_ratiosre   r   r   rw   rx   Nrz   r{   r   r   r   Útest_constrained_layout11ratè   s   

r€   zconstrained_layout12.pngc                  C   sÖ   t jddd} tjdd| d}|  |dd…d	f ¡}|  |dd…d	f ¡}t|d
d t|d
d |  |dd…df ¡}t|dd |  |dd…df ¡}t|dd |  |dd…df ¡}t|dd | d¡ dS )z/Test that very unbalanced labeling still works.r*   )r~   é   rv   r~   r   rH   Nr   r   é   r   r   T)r   rd   r
   )r.   r/   r   r]   r0   r   r   )r2   r|   Úax1Úax2r   r   r   r   Útest_constrained_layout12ü   s   r…   zconstrained_layout13.pngc                  C   s’   t jdddd\} }|jD ]}t|dd}| j||dddd	 qt t¡ |  ¡ j	d
dd W d  ƒ n1 s9w   Y  |  ¡ j	ddd dS )úTest that padding works.r   r*   r+   r   r   r   ç      4@r9   ©r   rA   ry   r:   r   )ZwpadZhpadNçUUUUUUÕ?©Úw_padÚh_pad)
r.   r4   r5   r(   r<   rZ   ZraisesÚ	TypeErrorÚget_layout_engineÚsetrC   r   r   r   Útest_constrained_layout13  s   
ÿr   zconstrained_layout14.pngc                  C   sZ   t jdddd\} }|jD ]}t|dd}| j||dddd	 q|  ¡ jd
d
ddd dS )r†   r   r*   r+   r   r   r   r‡   r9   rˆ   gUUUUUU¥?çš™™™™™É?©r‹   rŒ   ÚhspaceZwspaceN)r.   r4   r5   r(   r<   rŽ   r   rC   r   r   r   Útest_constrained_layout14  s   

þr”   zconstrained_layout15.pngc                  C   s6   dt jd< t dd¡\} }|jD ]}t|dd qdS )zTest that rcparams work.Tzfigure.constrained_layout.user   r   r   N)ÚmplÚrcParamsr.   r4   r5   r   r6   r   r   r   Útest_constrained_layout15*  s
   

ÿr—   zconstrained_layout16.pngc                  C   s.   t jdd\} }t|dd |  g d¢¡}dS )zTest ax.set_position.r*   r+   r   r   )r‘   r‘   çš™™™™™Ù?r˜   N)r.   r4   r   Úadd_axes©r2   r   r„   r   r   r   Útest_constrained_layout163  s   r›   zconstrained_layout17.pngc                  C   s”   t jdd} tjdd| d}|  |d ¡}|  |ddd…f ¡}|  |dd…dd	…f ¡}|  |dd…d
f ¡}t|ƒ t|ƒ t|ƒ t|ƒ dS )zTest uneven gridspecsr*   r+   r   rH   ©r   r   r   r   Nr   r   )r.   r/   r   r]   r0   r   )r2   rK   rƒ   r„   Úax3Zax4r   r   r   Útest_constrained_layout17;  s   rž   c                  C   sT   t jdd\} }| ¡ }t|ƒ t|dd |  ¡  t| ¡ j| ¡ jkƒs(J ‚dS )z
Test twinxr*   r+   r-   r   N)r.   r4   Ztwinxr   rR   ÚallrS   Úextentsrš   r   r   r   Útest_constrained_layout18L  s    r¡   c                  C   sh   t jdd\} }| ¡ }t|ƒ t|dd | d¡ | d¡ |  ¡  t| ¡ j| ¡ jkƒs2J ‚dS )z
Test twinyr*   r+   r-   r   rf   N)	r.   r4   Ztwinyr   r   rR   rŸ   rS   r    rš   r   r   r   Útest_constrained_layout19V  s   

 r¢   c                  C   sh   t  ddd¡} t  | | dd…df ¡}t ¡ }| g d¢¡}| | | |dd…dd…f ¡}| |¡ dS )z)Smoke test cl does not mess up added Axeséûÿÿÿr   rd   N)r   r   r   r   r   )r    ZlinspaceÚhypotr.   r/   r™   r#   r<   )ZgxZimgr2   r   Zmeshr   r   r   Útest_constrained_layout20b  s   r¥   c                  C   sf   t jdd\} }|  d¡ |  ¡  t | ¡ j¡}|  d¡ |  ¡  t | ¡ j¡}tj 	||¡ dS )z>#11035: repeated calls to suptitle should not alter the layoutr*   r+   Z	Suptitle0Z	Suptitle1N)
r.   r4   rn   rR   r    ÚcopyrS   r    ÚtestingÚassert_allclose©r2   r   Zextents0Úextents1r   r   r   Útest_constrained_layout21m  s   

r«   c                  C   s`   t jdd\} }|  ¡  t | ¡ j¡}| jddd |  ¡  t | ¡ j¡}tj 	||¡ dS )zC#11035: suptitle should not be include in CL if manually positionedr*   r+   ÚSuptitlerr   ©r$   N)
r.   r4   rR   r    r¦   rS   r    rn   r§   r¨   r©   r   r   r   Útest_constrained_layout22|  s   r®   c                  C   sN   t dƒD ] } tjdddd}| dd¡}|d  dd¡}| d| › ¡ qd	S )
zu
    Comment in #11035: suptitle used to cause an exception when
    reusing a figure w/ CL with ``clear=True``.
    r   r*   TZ123)r,   ÚclearÚnumr   r   r¬   N)rQ   r.   r/   rI   rJ   rn   )rV   r2   rK   Úsubr   r   r   Útest_constrained_layout23Š  s   ür²   ztest_colorbar_location.pngT)Úremove_textr)   c                  C   sö   dt jd< t jdddd\} }|jD ]}t|ƒ}| d¡ | d¡ q| j||dd…d	f d
d | j||ddd…f ddd | j||ddd…f dddd | j||ddd…f ddd | j||d ddd | j||d	d…df ddd dS )zY
    Test that colorbar handling is as expected for various complicated
    cases...
    Fzpcolormesh.snaprd   r   r*   r+   rf   Nr   r˜   )r   rA   r   r   rr   rE   )r   rA   rF   r   gš™™™™™©?)r   rA   rF   r:   éþÿÿÿr   Útoprœ   ÚleftÚright)r.   r–   r4   r5   r(   r   r   r<   rC   r   r   r   Útest_colorbar_location—  s   


 "r¸   c                  C   sX   t jdddd\} }|d  d¡ |  ¡  t |d  ¡ j¡}tjj	|g d¢dd	 d S )
Nr   r*   r+   rc   Frœ   )gý/×¢¨?g<Ü‹Qá?gd:tzÞÞ?g©¼á´`ï?çñhãˆµøä>)Úrtol)
r.   r4   Zset_visiblerR   r    r¦   rS   r    r§   r¨   )r2   r7   rª   r   r   r   Útest_hidden_axes®  s   

ÿr»   c               	   C   sr  dD ]´} t jdddd\}}g }t|jƒD ]@\}}|jdd t|ƒ}|j||| ddd	}||g7 }|jjdd |d
krU|jj 	g ¡ |jj
 	g ¡ | g ¡ | g ¡ q| ¡ jddddd | ¡  | dv rtj |d j ¡ j|d j ¡ j¡ tj |d
 j ¡ j|d j ¡ j¡ qtj |d j ¡ j|d
 j ¡ j¡ tj |d j ¡ j|d j ¡ j¡ qd S )N)r·   r¶   rµ   rE   r   r*   r+   Úin)Ú	directionr   g{®Gáz¤?)r   rF   rA   r:   r   gÇqÇq¬?gš™™™™™¹?r’   )r¶   r·   r   r   )r.   r4   r;   r5   Útick_paramsr(   r<   r   ZxaxisZ	set_ticksÚyaxisr   r   rŽ   r   rR   r    r§   r¨   rS   Úx0rT   )rF   r2   r7   Zcbsr=   r   ÚpcÚcbr   r   r   Útest_colorbar_align»  sF   ÿ


€ÿÿÿÿÿårÃ   ztest_colorbars_no_overlapV.pngc                  C   s|   t jddd} | jddddd}|D ]$}|j t ¡ ¡ |jdd	d
 | ddgddgg¡}| j	||dd q|  
d¡ d S )N)r   rd   r*   ra   r   r   T©rj   rk   Úbothr¼   ©Úaxisr½   r   rd   Úvertical©r   ZorientationÚfoo)r.   r/   r4   r¿   Úset_major_formatterr   ÚNullFormatterr¾   Úimshowr<   rn   ©r2   r7   r   Zimr   r   r   Útest_colorbars_no_overlapVÛ  s   rÏ   ztest_colorbars_no_overlapH.pngc                  C   s|   t jddd} |  d¡ | jddddd}|D ]$}|j t ¡ ¡ |jd	d
d | 	ddgddgg¡}| j
||dd qd S )N)rd   r   r*   ra   rÊ   r   r   TrÄ   rÅ   r¼   rÆ   r   rd   Ú
horizontalrÉ   )r.   r/   rn   r4   r¿   rË   r   rÌ   r¾   rÍ   r<   rÎ   r   r   r   Útest_colorbars_no_overlapHç  s   
ürÑ   c                  C   sÖ   t jdddd\} }|d  g d¢¡ |  ¡  |d  ¡ }tj |ddgddgg¡ t jdddd\} }|d  g d¢¡ |d  tj	 
d	d	¡¡}| j||d d
 |  ¡  |d  ¡ }tj |ddgddgg¡ d S )Nr   r   r*   r+   r   ©r‘   r‘   ç333333Ó?rÓ   r‘   rr   é   ©r   g)\Âõ(Ü?)r.   r4   Zset_positionrR   rS   r    r§   r¨   r#   ÚrandomZrandr<   )r2   r7   ÚpprÁ   r   r   r   Útest_manually_set_positionó  s   rØ   ztest_bboxtight.pngZbbox_inchesZtight)r³   r)   Zsavefig_kwargc                  C   ó   t jdd\} }| d¡ d S ©Nr*   r+   r   ©r.   r4   rm   r1   r   r   r   Útest_bboxtight  s   rÜ   ztest_bbox.pngrr   g      @r   c                  C   rÙ   rÚ   rÛ   r1   r   r   r   Ú	test_bbox  s   rÝ   c                  C   sà   t jddddddid\} \}}}| dd¡ | d	¡ | d
d¡ | d	¡ | dd¡ | d	¡ | j|||fd |  ¡  |jj ¡ |jj ¡ |jj ¡ g}t	j
j|d j|d jg|d jddd |d jdksnJ ‚dS )zî
    Tests for a bug in which constrained layout and align_ylabels on
    three unevenly sized subplots, one of whose y tick labels include
    negative numbers, drives the non-negative subplots' y labels off
    the edge of the plot
    r   r   r*   )gš™™™™™@r   r   )r   r   gffffffæ?)r,   rb   Úgridspec_kwr   ÚLabelg      ø¿g      ø?)r7   r   r¹   )rº   ÚatolN)r.   r4   Zset_ylimr   Zalign_ylabelsrR   r¿   rq   Zget_window_extentr    r§   r¨   rÀ   )r2   r   rƒ   r„   Zafter_alignr   r   r   Útest_align_labels  s(   
þ





þÿrá   c                  C   s  t jdd\} }|  ¡  | | j ¡ ¡}|  d¡ |  d¡ |  ¡  | | j ¡ ¡}|j|jd ks4J ‚|j	|j	d ks>J ‚t jdd\} }|  ¡  | | j ¡ ¡}| jddd | jddd |  ¡  | | j ¡ ¡}|j|jd ksvJ ‚|j	|j	d ks€J ‚d S )	Nr*   r+   ÚBooZBooyg      $@rr   )r%   r­   )
r.   r4   rR   Zget_tightbboxZcanvasZget_rendererZ	supxlabelZ	supylabelrT   rÀ   )r2   r   Zpos0Úposr   r   r   Útest_suplabels6  s$   

rä   c                  C   s:   t  ¡ } |  dd¡}|  |dd …dd …f ¡}|  ¡  d S )Nr   r   r   )r.   r/   rI   r0   rR   )r2   rK   Úspr   r   r   Útest_gridspec_addressingM  s   ræ   c                  C   s¼   t jdd\} }|  ¡  tjtdd t  ¡ \} }|  d¡ |  ¡  W d   ƒ n1 s-w   Y  tjtdd t  ¡ \} }|  dddœ¡ |  ¡  W d   ƒ d S 1 sWw   Y  d S )NTrO   zwill be deprecatedrX   r9   rŠ   )r.   r4   rR   rZ   r[   ÚPendingDeprecationWarningÚset_constrained_layoutr1   r   r   r   Útest_discouraged_apiT  s    ÿ

üÿ
"üré   c                  C   s    t jddid\} }|  ¡  d S )NrŒ   r9   rO   )r.   r4   rR   r1   r   r   r   Útest_kwargse  s   rê   c                  C   sÀ   t jdd\} }|  ¡ jg d¢d |  ¡  | ¡ }|jdk s!J ‚|jdk s(J ‚t jdd\} }|  ¡ jg d¢d |  ¡  | ¡ }|jdk sIJ ‚|jdk sPJ ‚|jdksWJ ‚|j	dks^J ‚d S )Nr*   r+   )r   r   rr   rr   )Úrectrr   rÒ   r‘   )
r.   r4   rŽ   r   rR   rS   Úx1rU   rÀ   rT   )r2   r   Zpposr   r   r   Ú	test_rectj  s   rí   c                  C   sJ  t jdddddd\} }|jD ]}| tj dd¡¡}q| j||d |  ¡  |d  	¡ }tj
j|jd	d
d |d  	¡ }tj
j|jddd t jddddddd\} }|jD ]}| tj dd¡¡}qW| j||d |  ¡  |d  	¡ }tj
j|jddd tj
j|jdd
d |d  	¡ }tj
j|jddd tj
j|jdd
d d S )Nr   r   Ú
compressedTri   rÔ   rÕ   rœ   g™»–zÎ?r?   ©rà   rc   g™»–zæ?çü©ñÒMbP?)r   rd   )r,   rj   rk   rb   gÄZ|
€ñ¬?g+ö—Ý“‡ë?)r   r   g’\þCúíë?gMóŽSt$Ç?)r.   r4   r5   rÍ   r    rÖ   Zrandnr<   rR   rS   r§   r¨   rÀ   rì   rU   rT   )r2   r7   r   rÁ   rã   r   r   r   Útest_compressed1|  s0   

ÿ


ÿ
rñ   c                  C   sÐ   t jddddddœd\} \}}| d¡ | d	¡ | d¡ | d
¡ |  d¡}|  ¡  | ¡ d
 tjdddks<J ‚| jddd}|  ¡  | ¡ d
 dksQJ ‚| jddd}|  ¡  | ¡ d
 dksfJ ‚d S )Nr   )rd   r`   rî   )g      Ð?g      è?r   )r   r“   )Znrowsrb   r,   rÞ   Úequalr‰   r   r   gà- øç?rð   )Úabsg\Âõ(\ï?r­   F)Z	in_layout)	r.   r4   rÇ   Zset_box_aspectrn   rR   rS   rZ   Zapprox)r2   Zax0rƒ   Útitler   r   r   Útest_compressed_suptitle›  s"   þ




rõ   z
arg, state)TT)FFrë   c                 C   s$   t j| d\}}| ¡ |u sJ ‚d S )NrO   )r.   r4   Úget_constrained_layout)ÚargÚstater2   r   r   r   r   Útest_set_constrained_layout³  s   rù   c                  C   s~   t  ¡ \} }t t¡* |  d¡ |  ¡ sJ ‚|  d¡ |  ¡ r"J ‚|  d¡ |  ¡ s-J ‚W d   ƒ d S 1 s8w   Y  d S )NTF)r.   r4   rZ   r[   rç   rè   rö   r1   r   r   r   Útest_constrained_toggle¾  s   


"úrú   c                  C   sP   t jddd} |  ¡  |  ¡  t  d¡ ~ t ¡  tdd„ t ¡ D ƒƒr&J ‚d S )NT)r`   r`   )rP   rb   rŸ   c                 s   s    | ]
}t |tjjƒV  qd S )N)Ú
isinstancer•   Z_layoutgridZ
LayoutGrid)Ú.0Úobjr   r   r   Ú	<genexpr>Ò  s   € ÿz#test_layout_leak.<locals>.<genexpr>)	r.   r/   r0   rR   ÚcloseÚgcÚcollectÚanyZget_objects)r2   r   r   r   Útest_layout_leakÉ  s   
ÿr  c                  C   sÎ   t jddd} |  dd¡}g }| ¡ D ].}| dd¡}tdƒD ]}|| ||df ¡g7 }|d  ¡  q| |d	d	…df ¡ ¡  q|  ¡  |dd	… D ]}t	j
| ¡ jd |d  ¡ jd d
dsdJ ‚qLd	S )z‚
    Test that the submerged margin logic does not get called multiple times
    on same axes if it is already in a subfigure
    )rd   r   r*   ra   r   r   r   r   r   Ngíµ ÷Æ°>rï   )r.   r/   Z
subfiguresÚflattenrI   rQ   r0   r   rR   r    ZallcloserS   Zbounds)r2   Zfiguresr7   ÚfrK   rV   r   r   r   r   Útest_submerged_subfigÖ  s   ÿÿr  )r   F)r   )Fr   ÚplatformÚnumpyr    rZ   Z
matplotlibr•   Zmatplotlib.testing.decoratorsr   Zmatplotlib.pyplotZpyplotr.   Zmatplotlib.transformsZ
transformsZmtransformsr   r   ÚmarkZusefixturesZ
pytestmarkr   r(   r3   r8   r>   rD   rG   rN   rW   r_   rh   ro   Úmachinert   r}   r€   r…   r   r”   r—   r›   rž   r¡   r¢   r¥   r«   r®   r²   r¸   r»   rÃ   rÏ   rÑ   rØ   rÜ   ZBboxrÝ   rá   rä   ræ   ré   rê   rí   rñ   rõ   Zparametrizerù   rú   r  r  r   r   r   r   Ú<module>   sÄ    
ÿ





	



ÿ









ÿ
 

þ
ÿþ
"
ü
