+
     ]i1  c                   s`    R t ^ RIt^ RIt^ RIHtHt ^ RIH	t	 ^ RI
Ht RR ltR	R ltR
R ltR# )a  
Routines to adjust subplot params so that subplots are
nicely fit in the figure. In doing so, only axis labels, tick labels, Axes
titles and offsetboxes that are anchored to Axes are currently considered.

Internally, this module assumes that the margins (left margin, etc.) which are
differences between ``Axes.get_tightbbox`` and ``Axes.bbox`` are independent of
Axes position. This may fail if ``Axes.adjustable`` is ``datalim`` as well as
such cases as when left or right margin are affected by xlabel.
N)_apiartist)FontProperties)Bboxc
                sN   Vw  r\        \        P                  R,          R7      P                  4       ^H,          pWl,          pVe	   W|,          MTpVe	   W,          MTp\	        V4      \	        V4      8w  g   \	        V4      ^ 8X  d   \
        hV	f
   R;p;p;ppM-V	w  ppppV'       d
   ^V,
          MRpV'       d
   ^V,
          MRp\        P                  ! V
^,           V34      p\        P                  ! W^,           34      pVfH   V UUu. uF9  p\        P                  ! V Uu. uF  pVP                  RR7      NK  	  up4      NK;  	  ppp\        WEV4       EF  w  ppw  pp\        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      '       d   KG  . pV F:  pVP                  4       '       g   K  V\        P                  ! VV4      .,          pK<  	  \        P                  ! V4      pV P                   P#                  4       P%                  V4      pVVVP&                  3;;,          VP(                  VP(                  ,
          ,          uu&   VVVP*                  3;;,          VP,                  VP,                  ,
          ,          uu&   VVP&                  V3;;,          VP.                  VP.                  ,
          ,          uu&   VVP*                  V3;;,          VP0                  VP0                  ,
          ,          uu&   EK  	  V P3                  4       w  p p!V'       g   \5        VR,          P5                  4       ^ 4      VV ,          ,           pV P6                  p"V"'       dp   V"P9                  4       '       dZ   V P                   P#                  4       P%                  V"P;                  V4      4      P<                  p#VV#VV ,          ,           ,          pV'       g0   \5        VR,          P5                  4       ^ 4      VV ,          ,           pV'       g   \5        VR,          P5                  4       ^ 4      VV!,          ,           pV P>                  '       d   V P>                  P9                  4       '       dd   V P                   P#                  4       P%                  V P>                  P;                  V4      4      P@                  p$VV$VV!,          ,           ,          pV'       g   \5        VR,          P5                  4       ^ 4      VV!,          ,           pV PB                  p"V"'       dp   V"P9                  4       '       dZ   V P                   P#                  4       P%                  V"P;                  V4      4      P@                  p$VV$VV!,          ,           ,          pVV,           ^8  d   \D        PF                  ! R	4       R# VV,           ^8  d   \D        PF                  ! R
4       R# \I        V^V,
          V^V,
          R7      p%V^8  d   VR^R13,          P5                  4       VV ,          ,           p&^V,
          V,
          V&V^,
          ,          ,
          V,          p'V'^ 8  d   \D        PF                  ! R4       R# V&V',          V%R&   V
^8  d   V^R1R3,          P5                  4       VV!,          ,           p(^V,
          V,
          V(V
^,
          ,          ,
          V
,          p)V)^ 8  d   \D        PF                  ! R4       R# V(V),          V%R&   V%# u upi u uppi )a  
Return a dict of subplot parameters to adjust spacing between subplots
or ``None`` if resulting Axes would have zero height or width.

Note that this function ignores geometry information of subplot itself, but
uses what is given by the *shape* and *subplot_list* parameters.  Also, the
results could be incorrect if some subplots have ``adjustable=datalim``.

Parameters
----------
shape : tuple[int, int]
    Number of rows and columns of the grid.
span_pairs : list[tuple[slice, slice]]
    List of rowspans and colspans occupied by each subplot.
subplot_list : list of subplots
    List of subplots that will be used to calculate optimal subplot_params.
pad : float
    Padding between the figure edge and the edges of subplots, as a
    fraction of the font size.
h_pad, w_pad : float
    Padding (height/width) between edges of adjacent subplots, as a
    fraction of the font size.  Defaults to *pad*.
rect : tuple
    (left, bottom, right, top), default: None.
z	font.size)ZsizeNT)Zoriginalc              3   sJ   "   T F  qP                  4       '       * x  K  	  R # 5iN)get_visible).0ax   & ?/usr/lib64/python3.14/site-packages/matplotlib/_tight_layout.py	<genexpr>Z+_auto_adjust_subplotpars.<locals>.<genexpr>L   s     7h>>###hs   !#FNNNzuTight layout not applied. The left and right margins cannot be made large enough to accommodate all Axes decorations.zuTight layout not applied. The bottom and top margins cannot be made large enough to accommodate all Axes decorations.)leftrightbottomtopznTight layout not applied. tight_layout cannot make Axes width small enough to accommodate all Axes decorationsZwspacezpTight layout not applied. tight_layout cannot make Axes height small enough to accommodate all Axes decorations.hspace)r       )r   r   )r   r   )r   r   )%r   mplZrcParamsZget_size_in_pointsZlenZ
ValueErrornpZzerosr   Zunionget_positionzipZallr   martistZ_get_tightbbox_for_layout_onlyZtransFigureZinvertedZtransform_bboxstartZxminstopZxmaxZymaxZyminZget_size_inchesmaxZ
_supylabelZget_in_layoutZget_window_extentZwidthZ	_suptitleZheightZ
_supxlabelr    warn_externalZdict)*figrenderershape
span_pairssubplot_listax_bbox_listpadh_padw_padrectrowscolsZfont_size_inchZpad_inchZ	vpad_inchZ	hpad_inchZmargin_leftZmargin_bottomZmargin_rightZ
margin_topZ_rightZ_topZvspacesZhspacesZsubplotsr   Zax_bboxrowspancolspanZbbZtight_bbox_rawZ
tight_bboxZfig_width_inchZfig_height_inchZsuplabelZ	rel_widthZ
rel_heightkwargsr   Zh_axesZvspaceZv_axess*   &&&&&&&&&&                                r	   _auto_adjust_subplotparsr+      s   8 JD$\\+&((:(:(<rBN#H*/*;&I*/*;&I
:#l++s</@A/E|BFFFmFlZ370]FD%+q6z!%QX4
hhq$'(GhhQh'(G )*( JJJ26JK( 	 * 25
24-'-GW37h73337h777B~~w==b(KLL  B__--/>>~N
&'7<<*//+II'%&*//GLL*HH&w&':??W\\+II'g%&',,*HH&!24$ '*&9&9&;#NO '$-++-q1H^4KK>>..00002AA**8466;e 9x'>>>K75>--/3h~6MM**,a08O3KK
===S]]88::113BB//9;;A6 *x'???JGEN..0!4x7OO>>..00113BB**8466<f Z(?*BBBM\!Q& ? 	@ z!Q& ? 	@ {L(&*n&F
 axAbD!%%')n*DDl"[06TAX3FF$NA:  B C %F8ax2q!%%')o*EEj.=06TAX3FF$NA:  C D %F8Mm K*s   \!'\\!\!c                sF   . pV  F  pVP                  4       pVf   Tp\        VR4      '       d[   VP                  4       pVeF   VP                  4       pVP	                  4       pVe
   Wa8w  d   RpMVP                  4       '       d   RpMRpVP                  V4       K  	  V# )z
Return a list of subplotspec from the given list of Axes.

For an instance of Axes that does not support subplotspec, None is inserted
in the list.

If grid_spec is given, None is inserted for those not from the given
grid_spec.
Nget_subplotspec)Zget_axes_locatorZhasattrr,   Zget_topmost_subplotspecget_gridspecZlocally_modified_subplot_paramsappend)	axes_listZ	grid_specsubplotspec_listr   Zaxes_or_locatorZsubplotspecZgss   &&     r	   get_subplotspec_listr1      s     --/" O?$566)99;K&)AAC --/(&*7799"&KK,% (     c                s,   V Uu/ uF  q. bK  	  p	p\        W4       F  w  rW,          P                  V
4       K  	  V	P                  RR4      '       d   \        P                  ! R4       V	'       g   / # \        V	P                  4       4      pV	 Uu. uF  qP                  V 4      NK  	  pp\        R V	 4       4      p\        R V	 4       4      p. pV	 EF  pVP                  4       P                  4       w  pp\        VV4      w  pp\        VV4      w  ppV^ 8w  d   \        P                  ! R4       / u # V^ 8w  d   \        P                  ! R4       / u # VP                  \        VP                  P                  V,          VP                  P                  V,          4      \        VP                   P                  V,          VP                   P                  V,          4      34       EK  	  \#        WW3VVVWEVR7	      pVe   Ve~   Vw  ppppVe   VVR,          ,          pVe   VVR	,          ,          pVe   V^VR
,          ,
          ,          pVe   V^VR,          ,
          ,          p\#        WW3VVVWEVVVVV3R7
      pV# u upi u upi )a6  
Return subplot parameters for tight-layouted-figure with specified padding.

Parameters
----------
fig : Figure
axes_list : list of Axes
subplotspec_list : list of `.SubplotSpec`
    The subplotspecs of each Axes.
renderer : renderer
pad : float
    Padding between the figure edge and the edges of subplots, as a
    fraction of the font size.
h_pad, w_pad : float
    Padding (height/width) between edges of adjacent subplots.  Defaults to
    *pad*.
rect : tuple (left, bottom, right, top), default: None.
    rectangle in normalized figure coordinates
    that the whole subplots area (including labels) will fit into.
    Defaults to using the entire figure.

Returns
-------
subplotspec or None
    subplotspec kwargs to be passed to `.Figure.subplots_adjust` or
    None if tight_layout could not be accomplished.
NzcThis figure includes Axes that are not compatible with tight_layout, so results might be incorrect.c              3   T   "   T F  qP                  4       P                  x  K   	  R # 5ir   )r-   Znrowsr   ssr   r	   r
   *get_tight_layout_figure.<locals>.<genexpr>        EnOO%++n   &(c              3   r3   r   )r-   Zncolsr4   r   r	   r
   r6      r7   r8   zdtight_layout not applied: number of rows in subplot specifications must be multiples of one another.zgtight_layout not applied: number of columns in subplot specifications must be multiples of one another.)r   r   r    r!   r"   r#   r$   r   r   r   r   )r   r   r    r!   r"   r#   r$   r%   )r   r.   Zpopr    r   ZlistZvaluesr   r   r-   Zget_geometryZdivmodZslicer(   r   r   r)   r+   )r   r/   r0   r   r"   r#   r$   r%   r5   Zss_to_subplotsr   r    r!   Z	max_nrowsZ	max_ncolsr   r&   r'   Zdiv_rowZmod_rowZdiv_colZmod_colr*   r   r   r   r   s   &&&&&&&&                   r	   get_tight_layout_figurer9      s   @ (88'7"f'7N8i2!!"% 3$%%;	< 	--/0L3AB>ROOC(>LBEnEEIEnEEIJ __&335
d!)T2!)T2a<  ; < Ia<  ; < I"**""W,bjjoo.GH"**""W,bjjoo.GHJ 	K) 0 &c-6,B1;3?3?*-%IF F. $( feSF6N"DfX&&Fa&/)*E?Au%&C)#1:0F5?7C7C.1e04feS/IK MW 9 Cs   JJ)NHzG?NNNr   )r:   NNN)Z__doc__Znumpyr   Z
matplotlibr   r    r   r   Zmatplotlib.font_managerr   Zmatplotlib.transformsr   r+   r1   r9   ) r2   r	   <module>r;      s.   	   . 2 &IXDkr2   