
    gw[                     h   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 d[dZd\dZ edg      d        Z edg      d	        Z ed
g      d        Z edg      d        Z edgd      d        Z edgd      d        Zd Zd Z edg      d        Z edg      d        Z edg ej:                         dk(  rdnd       d        Z edg      d        Z ed g      d!        Z  ed"g      d#        Z! ed$gd%      d&        Z" ed'g      d(        Z# ed)g      d*        Z$ ed+g      d,        Z% ed-g      d.        Z&d/ Z'd0 Z(d1 Z)d2 Z*d3 Z+d4 Z, ed5gd6d78      d9        Z-d: Z.d; Z/ ed<gd7=      d>        Z0 ed?gd7=      d@        Z1dA Z2 edBgd6d7dCdDiE      dF        Z3 edGgd6d7dC ejh                  dHd gdIdJgg      iE      dK        Z5dL Z6dM Z7dN Z8dO Z9dP Z:dQ Z;dR Z<dS Z=ej|                  j                  dTdUdVi d6fdWdid6fg      dX        Z@dY ZAdZ ZBy)]    N)image_comparison)gridspectickerc                 
   | j                  ddg       | j                  d       |s:| j                  d|       | j                  d|       | j	                  d|       y | j                  g        | j                  g        y )	N         nbinsx-labelfontsizey-labelTitle)plotlocator_params
set_xlabel
set_ylabel	set_titleset_xticklabelsset_yticklabels)axr   nodecs      d/var/www/dash_apps/app1/venv/lib/python3.12/site-packages/matplotlib/tests/test_constrainedlayout.pyexample_plotr      sq    GGQFOA
i(3
i(3
Wx0
2
2    c           	         d\  }}t         j                  t        dd|z   |      t        dd|z   |      f   \  }}d|dz  z
  |dz  z   |dz  z   t        j                  |dz   |dz  z
        z  }| j	                  |||d dd df   d	d
dd      }| j                  d|       | j                  d|       | j                  d|       |S )N)333333?r   r	   r          @   r   RdBu_rg            ?T)cmapvminvmax
rasterizedr   r   r   r   )npmgridsliceexp
pcolormeshr   r   r   )r   r   dxdyyxzpcms           r   example_pcolorr4      s    FB88E"a"fb)"a"fb)* +DAq	
QVa1f	qAv	%a!q&0@)AAA
--1aSbSks#'  )CMM)hM/MM)hM/LL8L,Jr   zconstrained_layout1.pngc                  j    t        j                  d      } | j                         }t        |d       y)z,Test constrained_layout for a single subplotconstrainedlayout   r   N)pltfigureadd_subplotr   figr   s     r   test_constrained_layout1r?   '   s(     **M
*C		Bb!r   zconstrained_layout2.pngc                  v    t        j                  ddd      \  } }|j                  D ]  }t        |d        y)z(Test constrained_layout for 2x2 subplotsr   r6   r7   r9   r   N)r:   subplotsflatr   r>   axsr   s      r   test_constrained_layout2rE   /   s7     ||Aq7HChh &R"%&r   zconstrained_layout3.pngc                      t        j                  ddd      \  } }t        |j                        D ]0  \  }}t	        |d      }|dk(  rd}nd}| j                  |||	       2 y
)z3Test constrained_layout for colorbars with subplotsr   r6   r7   r9   r   r	   g{Gz?{Gz?)r   padN)r:   rA   	enumeraterB   r4   colorbar)r>   rD   nnr   r3   rH   s         r   test_constrained_layout3rL   7   se     ||Aq7HCCHH% *BR"-7CCSRS)*r   zconstrained_layout4.pngc                      t        j                  ddd      \  } }|j                  D ]  }t        |d      } | j	                  |dd       y	)
z;Test constrained_layout for a single colorbar with subplotsr   r6   r7   r9   r   {Gz?r   r   rH   shrinkNr:   rA   rB   r4   rJ   r>   rD   r   r3   s       r   test_constrained_layout4rS   E   sM     ||Aq7HChh .R"-.LL$sL3r   zconstrained_layout5.pnggMb`?)tolc                      t        j                  ddd      \  } }|j                  D ]  }t        |d      } | j	                  |dddd	
       y)zZ
    Test constrained_layout for a single colorbar with subplots,
    colorbar bottom
    r   r6   r7   r9   r   FrN   r   bottom)r   use_gridspecrH   rP   locationNrQ   rR   s       r   test_constrained_layout5rY   O   sX     ||Aq7HChh .R"-.LL#c"  $r   zconstrained_layout6.pngc            
         dt         j                  d<   t        j                  d      } | j                  dd|       }|d   j	                  dd      }|d   j	                  dd      }g }|D ]&  }| j                  |      }||gz  }t        |d	
       ( j                  d       g }|D ]&  }| j                  |      }||gz  }t        |d	
      }( | j                  |dddt        j                  d             y)z,Test constrained_layout for nested gridspecsFpcolormesh.snapr6   r7   r   r   r;   r      r   zx-label
MultiLinerN   gGz?rV   r!   r
   )r   rH   rP   rX   ticksN)r:   rcParamsr;   add_gridspecsubgridspecr<   r   r   r4   rJ   r   MaxNLocator)r>   gsgslgsraxslr   axsrr3   s           r   test_constrained_layout6rh   ^   s    ',CLL"#
**M
*C			!Qs		+B
Q%

Aq
!C
Q%

Aq
!CD &__R R"%& MM&'D .__R R"-.
 LL$))2  4r   c                     t        j                  d      } | j                  dd      }|d   j                  dd      }|d   j                  dd      }g }g }t	        d      D ]2  }|| j                  ||         gz  }|| j                  ||         gz  }4 | j                          |d   j                         j                  |d   j                         j                  kD  sJ y )NTconstrained_layoutr   r   r   r	   )
r:   r;   r`   ra   ranger<   draw_without_renderingget_positiony0y1)r>   GSGSAGSBaxaaxbis          r   test_identical_subgridspecrw   y   s    
**
-C			!Q	B
Q%

Aq
!C
Q%

Aq
!C
C
C1X )A'((A'(()  q6 ##c!f&9&9&;&>&>>>>r   c                  t   t        j                  t        d      5  t        j                  d      } t        j                  dd      }t        j                  dd|d         }t        j                  dd|d         }|D ]  }| j                  |        | j                          ddd       y# 1 sw Y   yxY w)	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matchr6   r7   r   r   r   N)
pytestwarnsUserWarningr:   r;   r   GridSpecGridSpecFromSubplotSpecr<   rm   )r>   rc   rd   re   s       r   test_constrained_layout7r      s    	 3
5 % jj.q!$..q!RU;..q!RU; 	 BOOB	  	""$% % %s   B	B..B7zconstrained_layout8.pngc                     t        j                  dd      } t        j                  dd|       }g }dD ]|  }|dk(  rd	g}ndd
g}|D ]h  }| j	                  |||f         }||gz  }t        |d       |dkD  r|j                  d       |d	k  r|j                  d       |j                  d       j ~ | j	                  |dddf         }||gz  }t        |d      }| j                  ||dd       y)z/Test for gridspecs that are not completely full)
   r!   r6   figsizer8   r	   r!   r\   r   r   r   r      	   r    r   NrN   r   rO   )
r:   r;   r   r~   r<   r4   r   r   r   rJ   )r>   rc   rD   jilistrv   r   r3   s           r   test_constrained_layout8r      s    **W]
;C			1a	,B
C 6CEFE 	AAqD*BB4KC2*1ub!1ub!LL	 
AqD	"BB4KC
a
(CLL$sL3r   zconstrained_layout9.pngc                  0   t        j                  ddddd      \  } }|j                  D ]1  }t        |d      }|j	                  d       |j                  d       3 j                  d       | j                  |d	d
       | j                  dd       y)z4Test for handling suptitle and for sharex and shareyr   r6   Fr8   sharexshareyr9   r   r   r    rN   r   rO   zTest Suptitle   N)	r:   rA   rB   r4   r   r   
set_aspectrJ   suptitlerR   s       r   test_constrained_layout9r      s     ||Aq#(8HChh R"-
b
b MM"LL$sL3LL2L.r   zconstrained_layout10.pngarm64gMb?c                      t        j                  ddd      \  } }|j                  D ](  }|j                  t	        j
                  d      d       * j                  dd	       y
)z%Test for handling legend outside axisr   r6   r7   r]   zThis is a label)labelzcenter left)g?      ?)locbbox_to_anchorN)r:   rA   rB   r   r)   arangelegendrC   s      r   test_constrained_layout10r      sV     ||Aq7HChh 8
		"%678II-
I;r   zconstrained_layout11.pngc                     t        j                  dd      } t        j                  dd|       }t        j                  dd|d         }t        j                  dd|d         }| j                  |d         }t        |d	       g }|D ]&  }| j                  |      }||gz  }t        |d	      }( | j                  |d
d       | j                  |d         }t        |d	       y)z"Test for multiple nested gridspecsr6   )   r	   r8   r   r   r   r\   r   r   r   r        Q@r   rP   aspectN	r:   r;   r   r~   r   r<   r   r4   rJ   r>   gs0rd   gsl0r   rD   rc   r3   s           r   test_constrained_layout11r      s     **M7
;C


Aq
-C

*
*1aQ
8C++Aq#a&9D	Q	 Ba 
C -__R tR!,- LLSL5	Q	 Ba r   zconstrained_layout11rat.pngc                     t        j                  dd      } t        j                  dd| ddg      }t        j                  dd|d         }t        j                  dd|d   ddg	      }| j                  |d         }t        |d
       g }|D ]&  }| j                  |      }||gz  }t        |d
      }( | j                  |dd       | j                  |d         }t        |d
       y)z4Test for multiple nested gridspecs with width_ratiosr6   )r   r	   r   r   r      )r;   width_ratiosr   )height_ratiosr   r   r   r   r   Nr   r   s           r   test_constrained_layout11ratr      s     **M7
;C


AqAq6
BC

*
*1aQ
8C++Aq#a&AOD	Q	 Ba 
C -__R tR!,- LLSL5	Q	 Ba r   zconstrained_layout12.pngc                     t        j                  dd      } t        j                  dd|       }| j	                  |ddd	f         }| j	                  |ddd	f         }t        |d
       t        |d
       | j	                  |dddf         }t        |d       | j	                  |dddf         }t        |d       | j	                  |dddf         }t        |d       |j                  d       y)z/Test that very unbalanced labeling still works.r6   )r      r   r   r   r\   Nr	   r      r   r   T)r   r   r   )r:   r;   r   r~   r<   r   r   )r>   r   ax1ax2r   s        r   test_constrained_layout12r      s     **M6
:C


Aq
-C
//#bqb!e*
%C
//#ab!e*
%Cr"r"	QqS!V	%B4 	QqS!V	%B4 	QRU	$B4 MM)r   zconstrained_layout13.pngrG   c                     t        j                  ddd      \  } }|j                  D ]%  }t        |d      }| j	                  ||ddd	       ' t        j                  t              5  | j                         j                  d
d       ddd       | j                         j                  dd       y# 1 sw Y   +xY w)Test that padding works.r   r6   r7   r]   r   r         4@rG   r   rP   r   rH   r   )wpadhpadNUUUUUU?w_padh_pad)
r:   rA   rB   r4   rJ   r{   raises	TypeErrorget_layout_enginesetrR   s       r   test_constrained_layout13r     s     ||Aq7HChh CR"-SRCTBC 
y	! 4###34gW=4 4s   )"B55B>zconstrained_layout14.pngc                      t        j                  ddd      \  } }|j                  D ]%  }t        |d      }| j	                  ||ddd	       ' | j                         j                  d
d
dd       y)r   r   r6   r7   r]   r   r   r   rG   r   gUUUUUU?皙?r   r   hspacewspaceN)r:   rA   rB   r4   rJ   r   r   rR   s       r   test_constrained_layout14r     sy     ||Aq7HChh CR"-SRCTBC s   $r   zconstrained_layout15.pngc                      dt         j                  d<   t        j                  dd      \  } }|j                  D ]  }t        |d        y)zTest that rcparams work.Tzfigure.constrained_layout.user   r]   r   N)mplr_   r:   rA   rB   r   rC   s      r   test_constrained_layout15r   (  sD     59CLL01||Aq!HChh &R"%&r   zconstrained_layout16.pngc                  v    t        j                  d      \  } }t        |d       | j                  g d      }y)zTest ax.set_position.r6   r7   r]   r   )r   r   皙?r   N)r:   rA   r   add_axesr>   r   r   s      r   test_constrained_layout16r   1  s/     ll-0GCb!
,,+
,Cr   zconstrained_layout17.pngc                  t   t        j                  d      } t        j                  dd|       }| j	                  |d         }| j	                  |dddf         }| j	                  |dddd	f         }| j	                  |ddd
f         }t        |       t        |       t        |       t        |       y)zTest uneven gridspecsr6   r7   r	   r\   r   r   r   r   Nr   r"   )r:   r;   r   r~   r<   r   )r>   rc   r   r   ax3ax4s         r   test_constrained_layout17r   9  s     **M
*C			1a	,B
//"T(
#C
//"QU)
$C
//"QR1W+
&C
//"QRV*
%Cr   c                  &   t        j                  d      \  } }|j                         }t        |       t        |d       | j	                          t        |j                         j                  |j                         j                  k(        sJ y)z
Test twinxr6   r7   r9   r   N)r:   rA   twinxr   rm   allrn   extentsr   s      r   test_constrained_layout18r   J  sl    ll-0GC
((*Cr" r ((C,<,<,>,F,FFGGGr   c                  j   t        j                  d      \  } }|j                         }t        |       t        |d       |j	                  d       |j	                  d       | j                          t        |j                         j                  |j                         j                  k(        sJ y)z
Test twinyr6   r7   r9   r   r   N)	r:   rA   twinyr   r   rm   r   rn   r   r   s      r   test_constrained_layout19r   T  s    ll-0GC
((*Cr"MM"LL r ((C,<,<,>,F,FFGGGr   c                     t        j                  ddd      } t        j                  | | dddf         }t        j                         }|j                  g d      }|j                  | | |ddddf         }|j                  |       y)z)Smoke test cl does not mess up added Axesr!   r   N)r   r   r   r   r"   )r)   linspacehypotr:   r;   r   r-   rJ   )gximgr>   r   meshs        r   test_constrained_layout20r   `  ss    	RA	B
((2r!T'{
#C
**,C	l	#B==RSbS#2#X/DLLr   c                     t        j                  d      \  } }| j                  d       | j                          t	        j
                  |j                         j                        }| j                  d       | j                          t	        j
                  |j                         j                        }t        j                  j                  ||       y)z>#11035: repeated calls to suptitle should not alter the layoutr6   r7   	Suptitle0	Suptitle1N)
r:   rA   r   rm   r)   copyrn   r   testingassert_allcloser>   r   extents0extents1s       r   test_constrained_layout21r   k  s    ll-0GCLL wwr(001HLL wwr(001HJJx2r   c                     t        j                  d      \  } }| j                          t        j                  |j                         j                        }| j                  dd       | j                          t        j                  |j                         j                        }t        j                  j                  ||       y)zC#11035: suptitle should not be include in CL if manually positionedr6   r7   Suptitler   r0   N)
r:   rA   rm   r)   r   rn   r   r   r   r   r   s       r   test_constrained_layout22r   z  s    ll-0GC wwr(001HLLsL# wwr(001HJJx2r   c                      t        d      D ]U  } t        j                  ddd      }|j                  dd      }|d   j	                  dd      }|j                  d|         W y	)
zu
    Comment in #11035: suptitle used to cause an exception when
    reusing a figure w/ CL with ``clear=True``.
    r   r6   T123)r8   clearnumr   r   r   N)rl   r:   r;   r`   ra   r   )rv   r>   rc   subs       r   test_constrained_layout23r     sc     1X %jjTuEa#e1%xs^$	%r   ztest_colorbar_location.pngTmpl20)remove_textstylec                  $   dt         j                  d<   t        j                  ddd      \  } }|j                  D ]/  }t	        |      }|j                  d       |j                  d       1 | j                  |ddd	f   d
       | j                  ||dddf   dd       | j                  ||dddf   ddd       | j                  ||dddf   dd       | j                  ||d   dd       | j                  ||d	ddf   dd       y)zY
    Test that colorbar handling is as expected for various complicated
    cases...
    Fr[   r   r!   r6   r7   r   Nr   r   )r   rP   r"   r   r   rV   )r   rP   rX   r   g?)r   rP   rX   rH   r	   topr   leftright)r:   r_   rA   rB   r4   r   r   rJ   rR   s       r   test_colorbar_locationr    s    ',CLL"#||Aq7HChh R 
b
b LLQT3L/LLR!VS8LDLLQUC(LMLLRVS5LALLT3L@LLQqS!VS7LCr   c                  *   t        j                  ddd      \  } }|d   j                  d       | j                          t	        j
                  |d   j                         j                        }t        j                  j                  |g dd	       y )
Nr   r6   r7   r   Fr   )g|R?g\	b?g&:?g9?q?h㈵>)rtol)
r:   rA   set_visiblerm   r)   r   rn   r   r   r   )r>   rD   r   s      r   test_hidden_axesr    sy     ||Aq7HCI%  wws4y--/778HJJ9  Fr   c            	         dD ]  } t        j                  ddd      \  }}g }t        |j                        D ]  \  }}|j	                  d       t        |      }|j                  ||| dd	      }||gz  }|j                  j	                  d       |d
k7  sa|j                  j                  j                  g        |j                  j                  j                  g        |j                  g        |j                  g         |j                         j                  dddd       |j                          | dv rt         j"                  j%                  |d   j                  j'                         j(                  |d   j                  j'                         j(                         t         j"                  j%                  |d
   j                  j'                         j(                  |d   j                  j'                         j(                         t         j"                  j%                  |d   j                  j'                         j*                  |d
   j                  j'                         j*                         t         j"                  j%                  |d   j                  j'                         j*                  |d   j                  j'                         j*                          y )N)r   r   r   rV   r   r6   r7   in)	directionr   g{Gz?)r   rX   rP   rH   r   gqq?g?r   )r   r   r   r	   )r:   rA   rI   rB   tick_paramsr4   rJ   r   xaxis	set_ticksyaxisr   r   r   r   rm   r)   r   r   rn   x0ro   )rX   r>   rD   cbsrK   r   pccbs           r   test_colorbar_alignr    sG   6 D<<1];S) 	'FBNNTN*#BbR(3"&  (BB4KCEE-Qw%%b)%%b)""2&""2&	' 	##&+.s 	$ 	< 	""$((JJ&&s1vyy'='='?'B'B'*1vyy'='='?'B'BDJJ&&s1vyy'='='?'B'B'*1vyy'='='?'B'BD JJ&&s1vyy'='='?'B'B'*1vyy'='='?'B'BDJJ&&s1vyy'='='?'B'B'*1vyy'='='?'B'BD7Dr   ztest_colorbars_no_overlapV.png)r   c                  b   t        j                  dd      } | j                  dddd      }|D ]m  }|j                  j	                  t        j                                |j                  dd	
       |j                  ddgddgg      }| j                  ||d       o | j                  d       y )N)r   r   r6   r   r   r   Tr   r   bothr  axisr	  r	   r   verticalr   orientationfoo)r:   r;   rA   r  set_major_formatterr   NullFormatterr
  imshowrJ   r   r>   rD   r   ims       r   test_colorbars_no_overlapVr!    s    
**VM
:C
,,q!D,
6C 8
$$V%9%9%;<
Fd3YYAA'(RBJ7	8
 LLr   ztest_colorbars_no_overlapH.pngc                  b   t        j                  dd      } | j                  d       | j                  dddd      }|D ]m  }|j                  j                  t        j                                |j                  d	d
       |j                  ddgddgg      }| j                  ||d       o y )N)r   r   r6   r   r  r   r   Tr  r  r  r  r	   r   
horizontalr  )r:   r;   r   rA   r  r  r   r  r
  r  rJ   r  s       r   test_colorbars_no_overlapHr$    s    
**VM
:CLL
,,q!D,
6C :
$$V%9%9%;<
Fd3YYAA'(RBL9	:r   c                  |   t        j                  ddd      \  } }|d   j                  g d       | j                          |d   j	                         }t
        j                  j                  |ddgddgg       t        j                  ddd      \  } }|d   j                  g d       |d   j                  t
        j                  j                  d	d	            }| j                  ||d   
       | j                          |d   j	                         }t
        j                  j                  |ddgddgg       y )Nr   r   r6   r7   r   r   r   333333?r'  r   r      r   g)\(?)r:   rA   set_positionrm   rn   r)   r   r   r-   randomrandrJ   )r>   rD   ppr  s       r   test_manually_set_positionr.    s	   ||Aq7HCF,- 	Q			BJJrS#Jc
#;<||Aq7HCF,-	Q		299>>"b1	2BLLAL 	Q			BJJrS#Js#<=r   ztest_bboxtight.pngbbox_inchestight)r   r   savefig_kwargc                  X    t        j                  d      \  } }|j                  d       y Nr6   r7   r$   r:   rA   r   r=   s     r   test_bboxtightr5    s"     ll-0GCMM"r   ztest_bbox.pngr   g      @r   c                  X    t        j                  d      \  } }|j                  d       y r3  r4  r=   s     r   	test_bboxr7  	  s"    
 ll-0GCMM"r   c                     t        j                  ddddddi      \  } \  }}}|j                  dd       |j                  d	       |j                  d
d       |j                  d	       |j                  dd       |j                  d	       | j	                  |||f       | j                          |j                  j                  j                         |j                  j                  j                         |j                  j                  j                         g}t        j                  j                  |d   j                  |d   j                  g|d   j                  dd       |d   j                  dk\  sJ y)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   r6   )g@r   r   )r   r   gffffff?)r8   r   gridspec_kwr   Labelg      g      ?)rD   r   r  )r  atolN)r:   rA   set_ylimr   align_ylabelsrm   r  r   get_window_extentr)   r   r   r  )r>   r   r   r   after_aligns        r   test_align_labelsr@    sM    <<1]085D GL 5MNC#sC
 LLANN7LLsNN7LLANN73S/* 99??44699??44699??4468K JJA 1 1;q>3D3DE*1~00qu  F q>!!!r   c                     t        j                  d      \  } }| j                          |j                  | j                  j                               }| j                  d       | j                  d       | j                          |j                  | j                  j                               }|j                  |j                  dz   kD  sJ |j                  |j                  dz   kD  sJ t        j                  d      \  } }| j                          |j                  | j                  j                               }| j                  dd       | j                  dd       | j                          |j                  | j                  j                               }|j                  |j                  dz   kD  sJ |j                  |j                  dz   kD  sJ y )	Nr6   r7   BooBooyg      $@r   )r1   r   )
r:   rA   rm   get_tightbboxcanvasget_renderer	supxlabel	supylabelro   r  )r>   r   pos0poss       r   test_suplabelsrK  4  sj   ll-0GC CJJ3356DMM%MM& 


3::224
5C66DGGdN"""66DGGdN"""ll-0GC CJJ3356DMM%3MMM%3M 


3::224
5C66DGGdN"""66DGGdN"""r   c                      t        j                         } | j                  dd      }| j                  |dd dd f         }| j	                          y )Nr	   r   r   )r:   r;   r`   r<   rm   )r>   rc   sps      r   test_gridspec_addressingrN  K  sE    
**,C			!Q	B	ABF	$B r   c                     t        j                  d      \  } }| j                          t        j                  t
        d      5  t        j                         \  } }| j                  d       | j                          d d d        t        j                  t
        d      5  t        j                         \  } }| j                  ddd       | j                          d d d        y # 1 sw Y   ixY w# 1 sw Y   y xY w)NTrj   zwill be deprecatedry   rG   r   )r:   rA   rm   r{   r|   PendingDeprecationWarningset_constrained_layoutr=   s     r   test_discouraged_apirR  R  s    lld3GC 	/0
2 %,,.R""4(""$	% 
/0
2 %,,.R""TD#AB""$	% %% %% %s   9C&!<C2&C/2C;c                  Z    t        j                  ddi      \  } }| j                          y )Nr   rG   rj   )r:   rA   rm   r=   s     r   test_kwargsrT  c  s$    llwo>GC r   c                  <   t        j                  d      \  } }| j                         j                  g d       | j	                          |j                         }|j                  dk  sJ |j                  dk  sJ t        j                  d      \  } }| j                         j                  g d       | j	                          |j                         }|j                  dk  sJ |j                  dk  sJ |j                  dkD  sJ |j                  dkD  sJ y )Nr6   r7   )r   r   r   r   )rectr   r&  r   )
r:   rA   r   r   rm   rn   x1rp   r  ro   )r>   r   pposs      r   	test_rectrY  h  s    ll-0GC%56 ??D77S==77S==ll-0GC%9: ??D77S==77S==77S==77S==r   c                     t        j                  ddddd      \  } }|j                  D ]1  }|j                  t        j
                  j                  dd            }3 | j                  |       | j                          |d   j                         }t        j                  j                  |j                  d	d
       |d   j                         }t        j                  j                  |j                  dd
       t        j                  dddddd      \  } }|j                  D ]1  }|j                  t        j
                  j                  dd            }3 | j                  ||       | j                          |d   j                         }t        j                  j                  |j                  dd
       t        j                  j                  |j                  dd
       |d   j                         }t        j                  j                  |j                  dd
       t        j                  j                  |j                  dd
       y )Nr	   r   
compressedTr   r(  r)  r   gX ?MbP?)r;  r   gz?)r!   r   )r8   r   r   r   gGr鷯?gQ?)r   r   gk+ݓ?goT?)r:   rA   rB   r  r)   r+  randnrJ   rm   rn   r   r   r  rW  rp   ro   )r>   rD   r   r  rJ  s        r   test_compressed1r^  z  s   ||Aq#'6HChh 0YYryyr2./0 LLL 
d)
 
 
"CJJsvvvD9
d)
 
 
"CJJsvvvD9 ||Aq#'fFHChh 0YYryyr2./0 LLL 
d)
 
 
"CJJsvvwT:JJsvvvD9
d)
 
 
"CJJsvvvD9JJsvvvD9r   c                  X   t        j                  dddddd      \  } \  }}|j                  d       |j                  d	       |j                  d       |j                  d
       | j	                  d      }| j                          |j                         d
   t        j                  dd      k(  sJ | j	                  dd      }| j                          |j                         d
   dk(  sJ | j	                  dd      }| j                          |j                         d
   dk(  sJ y )Nr   )r   r   r[  )g      ?g      ?r   )r   r   )nrowsr   r8   r9  equalr   r   r   g??r\  )absg\(\?r   F)	in_layout)	r:   rA   r  set_box_aspectr   rm   rn   r{   approx)r>   ax0r   titles       r   test_compressed_suptitlerh    s   ll&4BDOC#s HHWsHHWqLL!E "fmmF&EEEELLDL)E "d***LLEL2E "d***r   z
arg, state)TT)FFrV  c                 ^    t        j                  |       \  }}|j                         |u sJ y )Nrj   )r:   rA   get_constrained_layout)argstater>   r   s       r   test_set_constrained_layoutrm    s-     llc2GC%%'5000r   c                  b   t        j                         \  } }t        j                  t              5  | j                  d       | j                         sJ | j                  d       | j                         rJ | j                  d       | j                         sJ 	 d d d        y # 1 sw Y   y xY w)NTF)r:   rA   r{   r|   rP  rQ  rj  r=   s     r   test_constrained_togglero    s    llnGC	/	0 ,""4())+++""5)--///""4())+++, , ,s   A*B%%B.c                     t        j                  dd      } | j                          | j                          t        j                  d       ~ t        j                          t        d t        j                         D              rJ y )NT)r   r   )rk   r   r   c              3   d   K   | ](  }t        |t        j                  j                         * y w)N)
isinstancer   _layoutgrid
LayoutGrid).0objs     r   	<genexpr>z#test_layout_leak.<locals>.<genexpr>  s)      0 c3??#=#=> 0s   .0)	r:   r;   r<   rm   closegccollectanyget_objects)r>   s    r   test_layout_leakr}    sm     **h
?COO IIeJJL 0 nn.0 0 0 0 0r   )r]   F)r]   )Cry  platformnumpyr)   r{   
matplotlibr   matplotlib.testing.decoratorsr   matplotlib.pyplotpyplotr:   matplotlib.transforms
transformsmtransformsr   r   r   r4   r?   rE   rL   rS   rY   rh   rw   r   r   r   machiner   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r  r!  r$  r.  r5  Bboxr7  r@  rK  rN  rR  rT  rY  r^  rh  markparametrizerm  ro  r}   r   r   <module>r     s   	     :  + '	
 ,-." /" ,-.& /& ,-.
* /
* ,-.4 /4 ,-59$ :$ ,-594 :44?(%  ,-.4 /46 ,-./ // -./x//1W<e!E<E< -./! 0!& 012! 3!& -./ 0* -.E:> ;> -./$ 0$ -./& 0& -./- 0- -./ 0 H	H33
% /0"'3D3D*
FD@ 34GD E 34GD: E:>  '("'!. 8::
 ?#"'!.!1!1!1C8c1X2F!G!IJ	J
"D#.!%"!
$:>+0 Jd^T	( 11
,
0r   