
    hz                        S r SSKrSSKrSSKJrJr  SSKJ	r
  SSKJr  \R                  " \5      r  SS jrSS jrS rS rS rSSSSS	.S
 jrSSSSS	.S jrSSS.S jrS rS rS rSSSSS	.S jrSS.S jrS rS rg)a	  
Adjust subplot layouts so that there are no overlapping Axes or Axes
decorations.  All Axes decorations are dealt with (labels, ticks, titles,
ticklabels) and some dependent artists are also dealt with (colorbar,
suptitle).

Layout is done via `~matplotlib.gridspec`, with one constraint per gridspec,
so it is possible to have overlapping Axes if the gridspecs overlap (i.e.
using `~matplotlib.gridspec.GridSpecFromSubplotSpec`).  Axes placed using
``figure.subplots()`` or ``figure.add_subplots()`` will participate in the
layout.  Axes manually placed via ``figure.add_axes()`` will not.

See Tutorial: :ref:`constrainedlayout_guide`

General idea:
-------------

First, a figure has a gridspec that divides the figure into nrows and ncols,
with heights and widths set by ``height_ratios`` and ``width_ratios``,
often just set to 1 for an equal grid.

Subplotspecs that are derived from this gridspec can contain either a
``SubPanel``, a ``GridSpecFromSubplotSpec``, or an ``Axes``.  The ``SubPanel``
and ``GridSpecFromSubplotSpec`` are dealt with recursively and each contain an
analogous layout.

Each ``GridSpec`` has a ``_layoutgrid`` attached to it.  The ``_layoutgrid``
has the same logical layout as the ``GridSpec``.   Each row of the grid spec
has a top and bottom "margin" and each column has a left and right "margin".
The "inner" height of each row is constrained to be the same (or as modified
by ``height_ratio``), and the "inner" width of each column is
constrained to be the same (as modified by ``width_ratio``), where "inner"
is the width or height of each column/row minus the size of the margins.

Then the size of the margins for each row and column are determined as the
max width of the decorators on each Axes that has decorators in that margin.
For instance, a normal Axes would have a left margin that includes the
left ticklabels, and the ylabel if it exists.  The right margin may include a
colorbar, the bottom margin the xaxis decorations, and the top margin the
title.

With these constraints, the solver then finds appropriate bounds for the
columns and rows.  It's possible that the margins take up the whole figure,
in which case the algorithm is not applied and a warning is raised.

See the tutorial :ref:`constrainedlayout_guide`
for more discussion of the algorithm with examples.
    N)_apiartistc                 L   U R                  5       n[        U SUS9nUS   (       d  [        R                  " S5        g[	        S5       GHW  n	[        XXqX#US9  [        XXqUS9  [        X5        X   R                  5         Sn
[        X5      (       a  [        XXqX#US9  U(       a  [        X5      nX   R                  5         [        X5      (       a  [        XXqX#US9  O[        R                  " U
5        U R                  =nby  UR                  5       (       ad  UR                  (       aS  UR                  5       u  pUR!                  XU    R#                  5       R$                  U-   45        UR'                  S	5        O[        R                  " U
5        [)        X5        GMZ     U$ )
a  
Do the constrained_layout.  Called at draw time in
 ``figure.constrained_layout()``

Parameters
----------
fig : `~matplotlib.figure.Figure`
    `.Figure` instance to do the layout in.

h_pad, w_pad : float
  Padding around the Axes elements in figure-normalized units.

hspace, wspace : float
   Fraction of the figure to dedicate to space between the
   Axes.  These are evenly spread between the gaps between the Axes.
   A value of 0.2 for a three-column layout would have a space
   of 0.1 of the figure width between each column.
   If h/wspace < h/w_pad, then the pads are used instead.

rect : tuple of 4 floats
    Rectangle in figure coordinates to perform constrained layout in
    [left, bottom, width, height], each from 0-1.

compress : bool
    Whether to shift Axes so that white space in between them is
    removed. This is useful for simple grids of fixed-aspect Axes (e.g.
    a grid of images).

Returns
-------
layoutgrid : private debugging structure
N)recthasgridszhThere are no gridspecs with layoutgrids. Possibly did not call parent GridSpec with the "figure" keyword   )h_padw_padhspacewspace)r	   r
   z{constrained_layout not applied because axes sizes collapsed to zero.  Try making figure larger or Axes decorations smaller.bottom)_get_renderermake_layoutgridsr   warn_externalrangemake_layout_marginsmake_margin_suptitlesmatch_submerged_marginsupdate_variablescheck_no_collapsed_axesreposition_axescompress_fixed_aspect	_suptitleget_in_layout_autoposget_positionset_positionget_inner_bboxy1set_verticalalignmentreset_margins)figr	   r
   r   r   r   compressrendererlayoutgrids_warn_collapsedsuptitlexs                P/var/www/html/env/lib/python3.13/site-packages/matplotlib/_constrained_layout.pydo_constrained_layoutr+   ?   s   H   "H"348Kz" / 	0 	1X 	Kh"'v	Gk$)	+ 	 1 	))+G #;44Kh"'vG3KE 113*;<<#Kh*/vO &&~6!$.X; ..00X5F5F#002DA)),;;=@@5HIK228<~.k'Y Z     c           	         Uc  [        5       nSUS'   [        U S5      (       d  [        R                  " USS9X'   OnU R                  R                  5       n[        X5      nX   n[        R                  " USSSSU R                  R                  U R                  R                  4S	9X'   U R                   H  n[        XQ5      nM     U R                   H#  nUR                  5       nUc  M  [        X5      nM%     U$ )
z
Make the layoutgrid tree.

(Sub)Figures get a layoutgrid so we can have figure margins.

Gridspecs that are attached to Axes get a layoutgrid so Axes
can have margins.
Fr   _parentfiglb)parentnamepanellbT   )r0   r1   parent_innernrowsncols
parent_pos)dicthasattrmlayoutgrid
LayoutGrid_subplotspecget_gridspecmake_layoutgrids_gsrowspancolspansubfigsr   
_localaxes)r"   r%   r   gsparentlbsfigaxs          r*   r   r      s     f"'J3	"" '11GL **, *+:?&111((00((0023 &t9  nn__>-k>K 
 r,   c           
      ~   X;   d  UR                   c  U $ SU S'   [        US5      (       d\  XR                      n[        R                  " USSUR                  UR
                  UR                  5       UR                  5       S9X'   U $ UR                  nUR                  5       nX@;  a  [        X5      n X   nUS4nX`;  a0  [        R                  " USSSUR                  UR                  4S9X'   [        R                  " X   SUR
                  UR                  UR                  5       UR                  5       S	9X'   U $ )
zJ
Make the layoutgrid for a gridspec (and anything nested in the gridspec)
Tr   _subplot_specgridspec)r0   r4   r1   r6   r5   width_ratiosheight_ratiostopr3   )r0   r1   r5   r6   r7   )r0   r1   r5   r6   rJ   rK   )figurer9   r:   r;   _ncols_nrowsget_width_ratiosget_height_ratiosrH   r=   r>   r?   r@   )r%   rC   r0   subplot_specparentgs	subspeclbreps          r*   r>   r>      sG   
 
BII- #K
2''YY'%00!iiryy002 2246< + '',,.&-kDK)	 5k!*55 q(00,2F2FG	 IK
 &00"'iiryy002 2246 r,   c                    UR                    H  n[        X5      nU(       a  M    g   UR                   H  nUR                  5       nXP;   d  M  X   n[	        UR
                  5       HT  n[	        UR                  5       H8  nUR                  Xx5      n	U	R                  S::  d  U	R                  S::  d  M6        g   MV     M     g)z1
Check that no Axes have collapsed to zero size.
Fr   T)
rA   r   axesr=   r   r5   r6   r   widthheight)
r%   r"   rE   okrF   rC   lgijbbs
             r*   r   r      s     $[7r  hh__B288_rxxA**10Bxx1}		Q$ ) %	  r,   c                    S nUR                    GH\  nUR                  5       c  M  UR                  5         UR                  5       nUR                  5       nUcC  Un[        R
                  " UR                  5      n[        R
                  " UR                  5      nOXR:w  a  [        S5      eUR                  SS9nUR                  SS9n	UR                  U	R                  -
  n
U
S:  a0  [        R                  " WUR                     U
5      XdR                  '   UR                  U	R                  -
  nUS:  d  GM,  [        R                  " WUR                     U5      XtR                  '   GM_     Uc  [        S5      e[        R                  " W5      S-  nX   R!                  SU5        X   R!                  S	U5        [        R                  " W5      S-  nX   R!                  S
U5        X   R!                  SU5        U $ )NzECannot do compressed layout if Axes are notall from the same gridspecToriginalFr   z>Cannot do compressed layout if no Axes are part of a gridspec.r   leftrightrL   r   )rW   get_subplotspecapply_aspectr=   npzerosr6   r5   
ValueErrorr   rX   maximumr@   rY   r?   sumedit_margin_min)r%   r"   rC   rF   sub_gsextrawextrahorigactualdwdhwhs                 r*   r   r     s   	Bhh'
  " :BXXbhh'FXXbhh'FY : ; ;-%0ZZ&,,&6"$**VCKK-@""EF;;[[6==(6"$**VCKK-@""EF;;) , 
z 3 4 	4
vA$$VQ/$$Wa0
vA$$UA.$$Xq1r,   r
   r	   r   r   c          	         U R                   nUR                  5       n[        US5      (       a7  UR                  b  UR                  OUnUR                  b  UR                  OUnO6UR
                  b  UR
                  OUnUR                  b  UR                  OUnUS-  nUS-  nUR                  5       u  pXX"SSSSS.nX-  U:  aB  UR                  R                  S:  a  X-  US'   UR                  R                  U
:  a  X-  US'   Xy-  U:  aB  UR                  R                  U	:  a  Xy-  US'   UR                  R                  S:  a  Xy-  US'   U$ )	Nr   r   r   )leftcbrightcbbottomcbtopcbrb   rc   rL   r   rx   ry   rz   r{   )r<   r=   r9   r   r   _hspace_wspaceget_geometryr@   startstopr?   )objr
   r	   r   r   ssrC   r|   r}   r5   r6   margins               r*   get_margin_from_paddingr   0  s?    
		B		Br8 "		 52996 "		 52996!#!72::V!#!72::VkGkG??$LE !!%F ::a&F8::??U" 'F9::??U"!(F:::a%oF7OMr,   c                   UR                    HJ  nUR                  nUR                  5       n	[        XUX4XVS9  [	        USSXVS9n
X	   R                  X5        ML     UR                   GH  nUR                  5       (       a  UR                  5       (       d  M0  UR                  5       nUR                  5       n	X;  a    g[	        XUXVS9n[        X5      u  pUS==   UR                  UR                  -
  -  ss'   US==   UR                  UR                  -
  -  ss'   US==   UR                  UR                  -
  -  ss'   US==   UR                  UR                  -
  -  ss'   UR                   GH  n[        X5      n[!        U5      u  nnUR"                  S   n[        X5      u  nnUS:X  a?  UR$                  UR&                  R$                  :X  a  US	==   UR(                  U-   -  ss'   OUS:X  a?  UR*                  UR&                  R*                  :X  a  US
==   UR(                  U-   -  ss'   OUS:X  a?  UR*                  UR,                  R*                  :X  a  US==   UR.                  U-   -  ss'   O>UR$                  UR,                  R$                  :X  a  US==   UR.                  U-   -  ss'   US;   a  UR*                  UR&                  R*                  :X  a>  UR                  UR                  :  a$  US==   UR                  UR                  -
  -  ss'   UR$                  UR&                  R$                  :X  a>  UR                  UR                  :  a$  US==   UR                  UR                  -
  -  ss'   US;   d  GM  UR$                  UR,                  R$                  :X  a>  UR                  UR                  :  a$  US==   UR                  UR                  -
  -  ss'   UR*                  UR,                  R*                  :X  d  GM  UR                  UR                  :  d  GM  US==   UR                  UR                  -
  -  ss'   GM     X	   R                  X5        GM
     UR0                   GH  nSnUR2                  (       d  M  UR4                  b  M(  Uc$  UR6                  R9                  5       R:                  nU" UR=                  U5      5      nUR(                  SU-  -   nUR.                  SU-  -   nUR2                  nUS:X  a  X   R?                  SU5        OUS:X  a  X   R?                  SU5        US:X  a  X   R?                  SU5        M  US:X  d  M  X   R?                  SU5        GM     g)aa  
For each Axes, make a margin between the *pos* layoutbox and the
*axes* layoutbox be a minimum size that can accommodate the
decorations on the axis.

Then make room for colorbars.

Parameters
----------
layoutgrids : dict
fig : `~matplotlib.figure.Figure`
    `.Figure` instance to do the layout in.
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
    The renderer to use.
w_pad, h_pad : float, default: 0
    Width and height padding (in fraction of figure).
hspace, wspace : float, default: 0
    Width and height padding as fraction of figure size divided by
    number of columns or rows.
rv   r   Nrb   rc   r   rL   locationry   rx   r{   rz   )rL   r   rb   rc   r   lowerupper) rA   r<   r=   r   r   edit_outer_margin_minsrB   rd   r   get_pos_and_bboxx0x1y0r   
_colorbarscolorbar_get_padget_cb_parent_spans_colorbar_infor   r@   rX   r   r?   rY   legends_outside_loc_bbox_to_anchortransFigureinvertedtransform_bboxget_tightbboxrk   )r%   r"   r$   r
   r	   r   r   rE   r   rC   marginsrF   r   posbboxcbaxpad	cbp_rspan	cbp_cspanloccbposcbbboxleginv_trans_figrt   ru   	legendlocs                              r*   r   r   V  s}   , __Kx"'#)	: *$aq17H..w;  nn!!##2+;+;+=+=!__ (06G$R2	 	v#&&477**w477SVV++xCFFTWW,,u366)) MMD";5C#6t#< Iy%%j1C,T<ME6g~>>RZZ__49%);;%??bjj&6&668$s(::$??bjj&6&667Ov}}s'::O>>RZZ__4:&&--#*==& ''OOrzz'7'77		DGG+6Ndgg		&99NNNbjjoo5		DGG+7Ovyy477'::O''NNbjjoo5		DGG+8$&))(;;$OOrzz'7'77		DGG+5MVYY%88MK "N 	..v:} B {{ 3 3 ;$ # 8 8 : I I !2!28!<=D

QY&Aa%i'A((IG# 001=g% 00:G# 00!<f$ 00;! r,   r
   r	   c          	         UR                   R                  5       R                  n[        R                  " SS/X4//5      nUR                   UR
                  -
  R                  U5      nUR                  nUR                  nUR                   H  n	[        X	UX4S9  M     UR                  b  UR                  R                  5       (       a  UR                  R                  5       n
[        UR                  SS5      (       ah  UR                  R                  U
S   SU-
  45        U" UR                  R                  U5      5      nX   R!                  SUR                  SU-  -   5        UR"                  b  UR"                  R                  5       (       a  UR"                  R                  5       n
[        UR"                  SS5      (       ae  UR"                  R                  U
S   U45        U" UR"                  R                  U5      5      nX   R!                  SUR                  SU-  -   5        UR$                  b  UR$                  R                  5       (       a  UR$                  R                  5       n
[        UR$                  SS5      (       ae  UR$                  R                  XS   45        U" UR$                  R                  U5      5      nX   R!                  S	UR                  SU-  -   5        g g g g )
Nr   r   r   Fr3   rL   r   r   rb   )r   r   r   mtransformsBboxtransSubfigurerY   rX   rA   r   r   r   r   getattrr   r   rk   
_supxlabel
_supylabel)r%   r"   r$   r
   r	   r   padboxh_pad_localw_pad_localrE   pr   s               r*   r   r     sa    OO,,.==M1v~67Foo  !"0."8 --K,,Kk$)	8  }} S]]%@%@%B%BMM&&(3==*e44MM&&!a+o'>? !<!<X!FGD,,UDKK!e)4KL
~~!cnn&B&B&D&DNN'')3>>:u55NN''1{(;< !=!=h!GHD,,X-1[[1u9-DF ~~!cnn&B&B&D&DNN'')3>>:u55NN''d(;< !=!=h!GHD,,VTZZ!e)5KL 6 'E!r,   c                 	   UR                    H  n[        X5        M     UR                  5        Vs/ s H/  nUR                  5       c  M  UR	                  5       (       d  M-  UPM1     nnU GH  nUR                  5       nUR                  5       U ;  a  UR                  U5        M;  XR                  5          n[        UR                  5      S:  Ga  [        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      n[        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      n	U H  n
U
R                  5       nXR                  5          nUc  M*  [        UR                  5      S:  d  ME  [        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      nX:  a  Un[        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      nX:  d  M  Un	M     UR                  SS  H  nUR                  SXS9  M     UR                  SS  H  nUR                  SXS9  M     [        UR                  5      S:  d  GMv  [        R                  " UR                  S	   UR                  SS    UR                  S
   UR                  SS    -   5      n[        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      nU GH  n
U
R                  5       nXR                  5          nUc  M+  [        UR                  5      S:  d  MF  [        R                  " [        R                  " UR                  S	   UR                  SS    UR                  S
   UR                  SS    -   5      U/5      n[        R                  " [        R                  " UR                  S   UR                  SS    UR                  S   UR                  SS    -   5      U/5      nGM     UR                  SS  H  nUR                  S	UUS9  M     UR                  SS  H  nUR                  SUUS9  M     GM     gs  snf )a  
    Make the margins that are submerged inside an Axes the same size.

    This allows Axes that span two columns (or rows) that are offset
    from one another to have the same size.

    This gives the proper layout for something like::
        fig = plt.figure(constrained_layout=True)
        axs = fig.subplot_mosaic("AAAB
CCDD")

    Without this routine, the Axes D will be wider than C, because the
    margin width between the two columns in C has no width by default,
    whereas the margins between the two columns of D are set by the
    width of the margin between A and B. However, obviously the user would
    like C and D to be the same size, so we need to add constraints to these
    "submerged" margins.

    This routine makes all the interior margins the same, and the spacing
    between the three columns in A and the two column in C are all set to the
    margins between the two columns of D.

    See test_constrained_layout::test_constrained_layout12 for an example.
    Nr3   rb   rx   rc   ry   )cellrL   r{   r   rz   )rA   r   get_axesrd   r   r=   removelenr@   rf   maxmargin_valsrk   r?   )r%   r"   rE   aaxsax1ss1lg1maxsublmaxsubrax2ss2lg2maxsubl2maxsubr2r\   maxsubtmaxsubbs                     r*   r   r     s   2 2  lln En! 23//2C nC E !!#[0JJsO**,- s{{aff'AB8)#++ab/:;G ff(Sb)9:	*3;;s+;<=G ))+!"2"2"45?s3;;'7!';!vv/AB@1#++ab/BC DH  )"*!vv0Sb1AB	23;;s3CDE FH  )"*  [[_##FG#< %[["%##GW#= & s{{aff&s{{127(QR9:G ff)#++cr*:;
+CKK,<=>G
 ))+!"2"2"45?3;;'!+"$&&"&&OOE23;;qr?COOG4S[[_EF+ #*$ #% #%&&"&&OOH5ckk#26FGOOJ7CR8HIJ+ #*$ #%  [[_##E7#; %[["%##HgA#> &} Es   S:
S:!S:c                    [         R                  n[         R                  * n[         R                  n[         R                  * nU R                  S    H  nUR                  5       n[	        UR
                  R                  U5      n[        UR
                  R                  U5      n[	        UR                  R                  U5      n[        UR                  R                  U5      nM     [        X5      n[        X45      nXx4$ )z
Figure out which subplotspecs this colorbar belongs to.

Parameters
----------
cbax : `~matplotlib.axes.Axes`
    Axes for the colorbar.
parents)rf   infr   rd   minr?   r   r   r   r@   r   )	r   rowstartrowstopcolstartcolstopr0   r   r?   r@   s	            r*   r   r   T  s     vvHvvgGvvHvvgG%%i0##%rzz''2bjjoow/rzz''2bjjoow/ 1 H&GH&Gr,   c                 "   U R                  SS9nU R                  SS9nUR                  UR                  UR                  -
  5      n[
        R                  " X5      nUc  UnX54$ UR                  UR                  R                  5       5      nX54$ )aK  
Get the position and the bbox for the Axes.

Parameters
----------
ax : `~matplotlib.axes.Axes`
renderer : `~matplotlib.backend_bases.RendererBase` subclass.

Returns
-------
pos : `~matplotlib.transforms.Bbox`
    Position in figure coordinates.
bbox : `~matplotlib.transforms.Bbox`
    Tight bounding box in figure coordinates.
FrootTr`   )
get_figurer   transformedr   r   martist_get_tightbbox_for_layout_onlyr   )rF   r$   r"   r   	tightbboxr   s         r*   r   r   m  s      --U-
#C
//4/
(C
//#,,s>
?C66rDI 9 $$S__%=%=%?@9r,   c                   UR                   UR                  -
  nUR                   H?  nX   R                  5       n	UR	                  U	R                  U5      S9  [        XUX4XeS9  MA     UR                   H  n
U
R                  5       b  U
R                  5       (       d  M+  U
R                  5       nUR                  5       nX;  a    gX   R                  UR                  UR                  S9n	UR                  U	5      nU
R                  U5        SSSSS.n[!        U
R"                  SSS2   5       H*  u  nnU
UR$                  S   S   :X  d  M  ['        U UUUS	9  M,     M     g)
z>
Reposition all the Axes based on the new inner bounding box.
)r   )r
   r	   r   r   Nrowscolsr   )rb   rc   r   rL   r   r   offset)r   r   rA   get_outer_bbox_redo_transform_rel_figr   r   rB   rd   r   r=   r   r?   r@   r   _set_position	enumerater   r   reposition_colorbar)r%   r"   r$   r
   r	   r   r   trans_fig_to_subfigrE   r   rF   r   rC   newbboxr   nnr   s                    r*   r   r     s^   
 //C,>,>> //1$$!!"56 	% 	88#%	6	  nn'r/?/?/A/A !__ --2::35:: . ? &44T:
!
 a1Q?!"--""56HBT((3A66#Kx+13 7- r,   r   c                   UR                   S   nUS   R                  5       nUR                  SS9nUR                  UR                  -
  n[        U5      u  pX   R                  UU	S9n
X   R                  XS9nUR                   S   nUR                   S   nUR                   S   nUR                   S	   nUR                   S
   n[        X5      u  nn[        X5      nUS;   Ga  UR                  UU5      R                  X5      nUS:X  an  UR                  UR                  -
  nU
R                  UR                  -
  US   -   nUUU-   -  nUS==   UR                  U-   -  ss'   UR                  US5      nGOUR                  UR                  -
  nU
R                  UR                  -
  nUUR                  * U-
  U-   US   -
  -  nUS==   UR                  U-   -  ss'   UR                  US5      nGOUR                  UU5      R                  X5      nUS:X  am  UR                   UR                   -
  nU
R"                  UR                   -
  US   -   nUUU-   -  nUS==   UR$                  U-   -  ss'   UR                  SU5      nOzUR                   UR                   -
  nU
R                   UR                   -
  nUUR$                  * U-
  U-   US   -
  -  nUS==   UR$                  U-   -  ss'   UR                  SU5      nUR'                  U5      nUR)                  UR                  5        UR+                  U5        UR-                  U5        US;   a  SU-  nUR/                  U5        UR1                  S5        U$ )aS  
Place the colorbar in its new place.

Parameters
----------
layoutgrids : dict
cbax : `~matplotlib.axes.Axes`
    Axes for the colorbar.
renderer : `~matplotlib.backend_bases.RendererBase` subclass.
    The renderer to use.
offset : array-like
    Offset the colorbar needs to be pushed to in order to
    account for multiple colorbars.
r   r   Fr   r   r   anchorfractionaspectshrinkr   rc   rb   rL   r   )r   rL   r3   auto)r   r=   r   r   r   r   get_bbox_for_cbr   r   r   shrunkanchoredr   r   rX   
translatedr   r   rY   r   set_transformr   
set_anchorset_box_aspect
set_aspect)r%   r   r$   r   r   rC   r"   r   	cb_rspans	cb_cspans
bboxparentpbr   r   r   r   r   r   r   cbpadpbcblmargindxbmargindys                            r*   r   r     sW     !!),G		 	 	"B
//u/
%C//C,>,>>.t4I00i6? 1 AJ		'	'Y	'	GB"":.H  *F"":.H  *F  *F$T4ME6
 [/E$$yy6*33F? whh*G(6'?:B%'/!B7Ov||e33O??2q)Dhh*G(B6<<-%''1F6NBBB6NfllU22N??2q)Dyy*33F?uhh*G(6%=8B%'/!B5MV]]U22M??1b)Dhh*G(B6==.5(72VH5EEEB8 55??1b)D--d3Ds))*tOOF$$VOOFMr,   c                 
   UR                    H  n[        X5        M     UR                   HC  nUR                  5       (       d  M  UR	                  5       nX@;   d  M1  X   R                  5         ME     X   R                  5         g)z
Reset the margins in the layoutboxes of *fig*.

Margins are usually set as a minimum, so if the figure gets smaller
the minimum needs to be zero in order for it to grow again.
N)rA   r!   rW   r   r=   )r%   r"   rE   rF   rC   s        r*   r!   r!     sh     k( hh"B --/	 
 ""$r,   c                     UR                   S   nUS   R                  5       n[        U5      u  pEX   R                  XES9nUR                   S   S;   a  UR                  nOUR
                  nUR                   S   U-  $ )Nr   r   r   r   )rc   rb   r   )r   r=   r   r   rX   rY   )r%   caxr   rC   r   r   	bboxoutersizes           r*   r   r     s      +G		 	 	"B.s3I..I.NI
*%)::e$t++r,   )NNr   r   r3   r3   F)r  ) __doc__loggingnumpyrf   
matplotlibr   r   r   matplotlib.transforms
transformsr   matplotlib._layoutgrid_layoutgridr:   	getLogger__name___logr+   r   r>   r   r   r   r   r   r   r   r   r   r   r!   r    r,   r*   <module>r     s   /b   . + , "
 :F#(Zz*Z+\("J +,1#$Q#L >?a s<l @A $MN^?B2: 1Qq'3T @D Nb%",r,   