+
     ]iU  c                   s    R t ^ RIt^ RIt^ RIt^ RIHt ^ RIHt ^ RI	H
t ^RIHt  ! R R4      t ! R R]4      t ! R	 R
]4      tR t ! R R]4      t ! R R]4      tR tRR ltR# )zJ
Helper classes to adjust the positions of multiple axes at drawing time.
N)_api)SubplotSpec)	axes_sizec                   s   a  ] tR t^t o RtRR ltR tR tR tR t	R t
R	 tR
 tR tR tR tR tRR ltR tR tR tR t]R 4       t]R 4       tRR ltR tR tRR ltRtV tR# )Dividera5  
An Axes positioning class.

The divider is initialized with lists of horizontal and vertical sizes
(:mod:`mpl_toolkits.axes_grid1.axes_size`) based on which a given
rectangular area will be divided.

The `new_locator` method then creates a callable object
that can be used as the *axes_locator* of the axes.
Nc                s    Wn         W n        W0n        W@n        W`n        V P                  V4       WPn        ^ V n        ^ V n        RV n	        R# )ak  
Parameters
----------
fig : Figure
pos : tuple of 4 floats
    Position of the rectangle that will be divided.
horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
    Sizes for horizontal division.
vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
    Sizes for vertical division.
aspect : bool, optional
    Whether overall rectangular area is reduced so that the relative
    part of the horizontal and vertical scales have the same scale.
anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}, default: 'C'
    Placement of the reduced rectangle, when *aspect* is True.
N)
_fig_pos_horizontal	_vertical_anchor
set_anchor_aspect
_xrefindex
_yrefindex_locator)selffigpos
horizontalverticalaspectanchors   &&&&&&&K/usr/lib64/python3.14/site-packages/mpl_toolkits/axes_grid1/axes_divider.py__init__ZDivider.__init__   sD    ( 		%!    c                    \         P                  ! V P                  4        Uu. uF  q"P                  V4      NK  	  up4      # u upi N)nparrayget_horizontalget_sizer   rendererZs   && r   get_horizontal_sizesZDivider.get_horizontal_sizes;   s5    xxt7J7J7LM7L!H-7LMNNM   Ac                r   r   )r   r   get_verticalr   r   r    r   get_vertical_sizesZDivider.get_vertical_sizes>   s5    xxt7H7H7JK7J!H-7JKLLKr"   c                    Wn         R# )z
Set the position of the rectangle.

Parameters
----------
pos : tuple of 4 floats
    position of the rectangle that will be divided
Nr   )r   r      &&r   set_positionZDivider.set_positionA   s	     	r   c                    V P                   # )z%Return the position of the rectangle.r&   r      &r   get_positionZDivider.get_positionL   s    yyr   c                s   \        V\        4      '       d2   \        P                  ! \        P
                  P                  VR7       M7\        V\        \        34      '       d   \        V4      ^8w  d   \        R4      hWn        R# )a?  
Parameters
----------
anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}
    Either an (*x*, *y*) pair of relative coordinates (0 is left or
    bottom, 1 is right or top), 'C' (center), or a cardinal direction
    ('SW', southwest, is bottom left, etc.).

See Also
--------
.Axes.set_anchor
)r   zanchor must be str or 2-tupleN)
isinstanceZstrr    check_in_listmtransformsBboxZcoefsZtupleZlistlenZ	TypeErrorr   )r   r   r'   r   r	   ZDivider.set_anchorP   sZ     fc""{//55fEFUDM22c&kQ6F;<<r   c                r)   )zReturn the anchor.)r   r*   r+   r   
get_anchorZDivider.get_anchord       ||r   c                s    R # r    r*   r+   r   get_subplotspecZDivider.get_subplotspech   s    r   c                r%   )zo
Parameters
----------
h : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
    sizes for horizontal division
Nr   )r   hr'   r   set_horizontalZDivider.set_horizontalk   s
     r   c                r)   )zReturn horizontal sizes.r6   r*   r+   r   r   ZDivider.get_horizontalt   s    r   c                r%   )zm
Parameters
----------
v : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`
    sizes for vertical division
Nr   )r   Zvr'   r   set_verticalZDivider.set_verticalx   s	     r   c                r)   )zReturn vertical sizes.r9   r*   r+   r   r#   ZDivider.get_vertical   s    ~~r   c                r%   )z%
Parameters
----------
aspect : bool
Nr
   r   r   r'   r   
set_aspectZDivider.set_aspect   s	     r   c                r)   )zReturn aspect.r;   r*   r+   r   
get_aspectZDivider.get_aspect   r3   r   c                s    Wn         R # r   r   )r   r   r'   r   set_locatorZDivider.set_locator   s     r   c                r)   r   r?   r*   r+   r   get_locatorZDivider.get_locator   s    }}r   c                st    V P                   f   V P                  4       # V P                  W4      P                  # r   )r   r,   bounds)r   axr      &&&r   get_position_runtimeZDivider.get_position_runtime   s0    == $$&&==.555r   c                sZ    V P                  ^ 4      w  r#V'       d   W,
          V,          # ^ #     )sum)sizesZtotalZrel_sumZabs_sums   &&  r   _calc_kZDivider._calc_k   s(     !99Q<.57*<1<r   c                sD    \         P                  ! ^ .W^.,          O4      # rF   )r   cumsum)rI   kr'   r   _calc_offsetsZDivider._calc_offsets   s!     yy!/u1v~/00r   c                s   Vf
   V^,           pVf
   V^,           pV P                   pV P                  p\        P                  ! V P                  W,
          W&,
          W5,
          WF,
          4      pV P
                  Vn        V# )a  
Return an axes locator callable for the specified cell.

Parameters
----------
nx, nx1 : int
    Integers specifying the column-position of the
    cell. When *nx1* is None, a single *nx*-th column is
    specified. Otherwise, location of columns spanning between *nx*
    to *nx1* (but excluding *nx1*-th column) is specified.
ny, ny1 : int
    Same as *nx* and *nx1*, but for row positions.
)r   r   	functoolsZpartial_locater5   )r   nxnynx1ny1xrefyreflocators   &&&&&   r   new_locatorZDivider.new_locator   so     ;q&C;q&C ##LL")RY
CJH"&"6"6r   c                s6   WP                   ,          pW0P                   ,          pW P                  ,          pW@P                  ,          pV P                  P                  P                  V P                  P
                  ,          w  rxV P                  WV4      w  rrV P                  V4      pV P                  V4      pV P                  WV,          4      pV P                  WV,          4      pV P                  4       '       d   \        VV4      pV P                  VV4      pV P                  VV4      pVR,          V^ ,          ,
          V,          pVR,          V^ ,          ,
          V,          p\        P                  P                  WW4      p\        P                  P                  WVV4      pVP!                  V P#                  4       V4      P$                  w  ppM&V P                  W4      pV P                  VV4      pYppVf   RpVf   RpVVV,          V,          ,           VV,          VV,          ,
          V,          ppVVV,          V,          ,           VV,          VV,          ,
          V,          pp\        P                  P                  VVVV4      # )z
Implementation of ``divider.new_locator().__call__``.

The axes locator callable returned by ``new_locator()`` is created as
a `functools.partial` of this method with *nx*, *ny*, *nx1*, and *ny1*
specifying the requested cell.
)r   r   r   bboxsizedpirE   r!   r$   rJ   r>   ZminrM   r/   r0   from_boundsanchoredr2   p0)r   rP   rQ   rR   rS   axesr   fig_wfig_hxywr7   ZhsizesZvsizesZk_hZk_vrL   oxoywwhhpbpb1x0y0x1w1y1h1s   &&&&&&&                       r   rO   ZDivider._locate   s    	oo
ooyy~~**TYY]]:..t>
a**84((2ll619-ll619-??CA##FA.B##FA.BR&2a5.E)BR&2a5.E)B!!--aA9B""..qR<C\\$//"3R8;;FB ##F0B##FC0BB;C;Cbfun$r#wB'75&@Bbfun$r#wB'75&@B++BB;;r   c                s   \         P                  ! . ROVR7       VR 8X  d8   V P                  P                  ^ V4       V ;P                  ^,          un        R# VR8X  d   V P                  P                  V4       R# VR8X  d8   V P                  P                  ^ V4       V ;P                  ^,          un        R# V P                  P                  V4       R# )leftrightbottompositionNrq   rr   rs   top)r    r.   r   Zinsertr   Zappendr   r   )r   ru   rZ   rD   r   append_sizeZDivider.append_size   s    =$,	.v##At,OOq O ##D)!NN!!!T*OOq ONN!!$'r   c                s    Vf   . ROpV F0  pV P                  V\        P                  ! W4      V,           4       K2  	  R# )a  
Add auto-adjustable padding around *use_axes* to take their decorations
(title, labels, ticks, ticklabels) into account during layout.

Parameters
----------
use_axes : `~matplotlib.axes.Axes` or list of `~matplotlib.axes.Axes`
    The Axes whose decorations are taken into account.
pad : float, default: 0.1
    Additional padding in inches.
adjust_dirs : list of {"left", "right", "bottom", "top"}, optional
    The sides where padding is added; defaults to all four sides.
Nrv   )rx   SizeZ_AxesDecorationsSize)r   use_axespadadjust_dirsZd   &&&& r   add_auto_adjustable_areaZ Divider.add_auto_adjustable_area  s9     <KAQ 9 9( F LM r   )	r   r
   r   r   r   r   r   r   r   )NC)FNN)皙?N)__name__
__module____qualname____firstlineno____doc__r   r!   r$   r(   r,   r	   r2   r5   r8   r   r:   r#   r=   r>   r@   rA   rE   ZstaticmethodrJ   rM   rW   rO   rx   r~   __static_attributes____classdictcell__)__classdict__s   @r   r   r      s     	>OM	( !6 = = 1 1
@-<^(N Nr   r   c                   s\   a a ] tR tRt oRtRRRRRRRR/V 3R	 lltR
 tR tR tRt	Vt
V ;t# )SubplotDivideri  zL
The Divider class whose rectangle area is specified as a subplot geometry.
r   Nr   r   r   r   c          	     s   < Wn         \        ST `	  T. ROT;'       g    . T;'       g    . WER7       V P                  \        P
                  ! W4      4       R# )a  
Parameters
----------
fig : `~matplotlib.figure.Figure`

*args : tuple (*nrows*, *ncols*, *index*) or int
    The array of subplots in the figure has dimensions ``(nrows,
    ncols)``, and *index* is the index of the subplot being created.
    *index* starts at 1 in the upper left corner and increases to the
    right.

    If *nrows*, *ncols*, and *index* are all single digit numbers, then
    *args* can be passed as a single 3-digit number (e.g. 234 for
    (2, 3, 4)).
horizontal : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`, optional
    Sizes for horizontal division.
vertical : list of :mod:`~mpl_toolkits.axes_grid1.axes_size`, optional
    Sizes for vertical division.
aspect : bool, optional
    Whether overall rectangular area is reduced so that the relative
    part of the horizontal and vertical scales have the same scale.
anchor : (float, float) or {'C', 'SW', 'S', 'SE', 'E', 'NE', 'N', 'NW', 'W'}, default: 'C'
    Placement of the reduced rectangle, when *aspect* is True.
)r   r   r   r   N)rG   rG      r   )figuresuperr   set_subplotspecr   Z_from_subplot_args)r   r   r   r   r   r   Zargs	__class__s   &&$$$$*r   r   ZSubplotDivider.__init__   sQ    6 l$.$4$4"x~~2 & 	 	7 	[;;CFGr   c                sh    V P                  4       P                  V P                  4      P                  # )z%Return the bounds of the subplot box.)r5   r,   r   rB   r*   r+   r   r,   ZSubplotDivider.get_positionA  s&    ##%224;;?FFFr   c                r)   )zGet the SubplotSpec instance.)_subplotspecr*   r+   r   r5   ZSubplotDivider.get_subplotspecE  s       r   c                sf    Wn         V P                  VP                  V P                  4      4       R# )zSet the SubplotSpec instance.N)r   r(   r,   r   )r   Zsubplotspecr'   r   r   ZSubplotDivider.set_subplotspecI  s%    '+224;;?@r   )r   r   )r   r   r   r   r   r   r,   r5   r   r   r   __classcell__r   r      @@r   r   r     sJ     Hd HT HH%(HBG!A Ar   r   c                   s   a a ] tR tRt oRtRV 3R lltRR/R ltRR ltRR ltRRR/R	 llt	R
 t
R tR tR tRtVtV ;t# )AxesDivideriO  z(
Divider based on the preexisting axes.
Nc           	     s  < Wn         Vf   \        P                  ! V4      V n        MW n        Vf   \        P                  ! V4      V n        MW0n        \        SV `  VP                  4       RV P                  .V P
                  .RRR7       R# )zG
Parameters
----------
axes : :class:`~matplotlib.axes.Axes`
xref
yref
Nr   )r   r   r   r   r   r   )	_axesry   ZAxesX_xrefZAxesY_yrefr   r   
get_figure)r   r_   rT   rU   r   s   &&&&r   r   ZAxesDivider.__init__T  sq     
<D)DJJ<D)DJJT__.D%)ZZLDJJ< $S 	 	2r   
axes_classc               s    V P                   pVf   \        V4      pV! VP                  4       VP                  RR7      3/ VB # NT)Zoriginal)r   Ztyper   r,   )r   r   kwargsr_   s   &$, r   _get_new_axesZAxesDivider._get_new_axesj  sH    zzdJ$//+T->->->-M $"$ 	$r   c                s   Vf)   \         P                  R,          V P                  ,          pV'       d   RMRpV'       dS   \        V\        P
                  4      '       g"   \        P                  ! W P                  R7      pV P                  WR4       \        V\        P
                  4      '       g"   \        P                  ! WP                  R7      pV P                  WQ4       T P                  V'       d   ^ M\        V P                  4      ^,
          V P                  R7      pV P                  ! R/ VB pVP                  V4       V# )z
Helper method for ``append_axes("left")`` and ``append_axes("right")``.

See the documentation of `append_axes` for more details.

:meta private:
zfigure.subplot.wspacerq   rr   Zfraction_refrP   rQ   r4   )mplrcParamsr   r-   ry   _Basefrom_anyrx   rW   r1   r   r   r   set_axes_locatorr   rZ   r{   
pack_startr   r   rV   rC      &&&&,   r   new_horizontalZAxesDivider.new_horizontalq  s     ;,,67$**DC"fc4::..mmCjjAS&$

++==JJ?D#""qC(8(8$9A$= #   )&)
G$	r   c                s   Vf)   \         P                  R,          V P                  ,          pV'       d   RMRpV'       dS   \        V\        P
                  4      '       g"   \        P                  ! W P                  R7      pV P                  WR4       \        V\        P
                  4      '       g"   \        P                  ! WP                  R7      pV P                  WQ4       T P                  V P                  V'       d   ^ M\        V P                  4      ^,
          R7      pV P                  ! R/ VB pVP                  V4       V# )z
Helper method for ``append_axes("top")`` and ``append_axes("bottom")``.

See the documentation of `append_axes` for more details.

:meta private:
zfigure.subplot.hspacers   rw   r   r   r4   )r   r   r   r-   ry   r   r   rx   rW   r   r1   r   r   r   r   r   r   new_verticalZAxesDivider.new_vertical  s     ;,,67$**DC$h%c4::..mmCjjAS&$

++==JJ?D#""qC$7!$; # = )&)
G$	r   c               s    \         P                  ! RV P                  R3RV P                  R3RV P                  R3RV P                  R3/VR7      w  rgV! W#3RVR	V/VB pV P                  P                  V4       V# )
a  
Add a new axes on a given side of the main axes.

Parameters
----------
position : {"left", "right", "bottom", "top"}
    Where the new axes is positioned relative to the main axes.
size : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
    The axes width or height.  float or str arguments are interpreted
    as ``axes_size.from_any(size, AxesX(<main_axes>))`` for left or
    right axes, and likewise with ``AxesY`` for bottom or top axes.
pad : :mod:`~mpl_toolkits.axes_grid1.axes_size` or float or str
    Padding between the axes.  float or str arguments are interpreted
    as for *size*.  Defaults to :rc:`figure.subplot.wspace` times the
    main Axes width (left or right axes) or :rc:`figure.subplot.hspace`
    times the main Axes height (bottom or top axes).
axes_class : subclass type of `~.axes.Axes`, optional
    The type of the new axes.  Defaults to the type of the main axes.
**kwargs
    All extra keywords arguments are passed to the created axes.
rq   Trr   Frs   rw   rt   r   r   )r    Zcheck_getitemr   r   r   Zadd_axes)	r   ru   rZ   r{   r   r   Zcreate_axesr   rC   s	   &&&&$,   r   append_axesZAxesDivider.append_axes  s    . #'"4"4T(($/d))51t(($/D%%u-	6

 # O",O9COGMO		2	r   c                s    V P                   f&   V P                  P                  4       pVR8X  d   R# R# V P                   # )NZautoFT)r
   r   r>   r<      & r   r>   ZAxesDivider.get_aspect  s6    <<ZZ**,F<<r   c                s    V P                   f)   V P                  P                  RR7      pVP                  # V P                   # r   )r   r   r,   rB   )r   rY   r   r   r,   ZAxesDivider.get_position  s7    99::**D*9D;;99r   c                sj    V P                   f   V P                  P                  4       # V P                   # r   )r   r   r2   r*   r+   r   r2   ZAxesDivider.get_anchor  s)    <<::((**<<r   c                s6    V P                   P                  4       # r   )r   r5   r*   r+   r   r5   ZAxesDivider.get_subplotspec  s    zz))++r   )r   r   r   r   )NFr   )r   r   r   r   r   r   r   r   r   r   r>   r,   r2   r5   r   r   r   r   r   r   r   r   O  sK     2,$$ $22 $  D  , ,r   r   c	                 s   Wb,          p	Ws,          p
\        V4      pVP                  w  rVP                  w  r\        P                  ! . VO^ N4      pRVRV1R3&   VVRRR13&   . V) OWP	                  4       ,
          Np\        P
                  P                  VV4      Ev ppVV
8  d   W,
          V,          p\        P                  ! ^ .VV,          V,           O4      pVR,          V^ ,          ,
          V,          pV^ ,          w  ppV^ ,          V,          V,           V,          p\        P                  P                  WW#4      p\        P                  P                  WVV4      pVP                  VV4      P                  w  ppVVVV3# )rG   NrX   )r1   ZTr   ZdiagrH   ZlinalgZsolverK   r/   r0   r\   r]   r^   )rb   rc   rd   r7   Zsummed_widthsZequal_heightsr`   ra   r   Ztotal_widthZ
max_heightZnZeq_relsZeq_abssZsm_relsZsm_abssZAZBZkarrayZheightre   rg   Zh0_relZh0_absrh   ri   rj   rk   rl   s   &&&&&&&&&                    r   rO   rO     sm   )KJ 	MA$G$G
'1AAbqb"fIAb#2#gJ2G82kKKM12A
 iiooa+OVV
&'1 
A56)G35	6B
R&2a5.E	!B"1%NFF
)F
V
#u	,B				%	%aA	1B



&
&qR
4C\\&"%((FBr2r>r   c                   @   a a ] tR tRt oRtRV 3R lltR tRtVtV ;t	# )HBoxDivideri  z
A `.SubplotDivider` for laying out axes horizontally, while ensuring that
they have equal heights.

Examples
--------
.. plot:: gallery/axes_grid1/demo_axes_hbox_divider.py
c                s(   < \         SV `  V^ V^ 4      # )aI  
Create an axes locator callable for the specified cell.

Parameters
----------
nx, nx1 : int
    Integers specifying the column-position of the
    cell. When *nx1* is None, a single *nx*-th column is
    specified. Otherwise, location of columns spanning between *nx*
    to *nx1* (but excluding *nx1*-th column) is specified.
r   rW   )r   rP   rR   r      &&&r   rW   ZHBoxDivider.new_locator  s     w"2q#q11r   c                s6   WP                   ,          pW0P                   ,          pV P                  P                  P                  V P                  P                  ,          w  rxV P                  WV4      w  rrV P                  V4      pV P                  V4      p\        WWWWxV P                  4       4	      w  ppppVf   RpVVV,          V,          ,           VV,          VV,          ,
          V,          ppTTpp\        P                  P                  VVVV4      # NrX   )r   r   rY   rZ   r[   rE   r!   r$   rO   r2   r/   r0   r\   )r   rP   rQ   rR   rS   r_   r   r`   ra   rb   rc   rd   r7   Z	summed_wsZequal_hsrk   rl   re   rh   rm   rn   ro   rp      &&&&&&&                r   rO   ZHBoxDivider._locate  s    
ooyy~~**TYY]]:..t>
a--h7	**84 !	U4??;LNBB;Cbfun$r#wB'75&@BRB++BB;;r   r4   r   
r   r   r   r   r   rW   rO   r   r   r   r   r   r   r   r     s     2< <r   r   c                   r   )VBoxDivideri-  za
A `.SubplotDivider` for laying out axes vertically, while ensuring that
they have equal widths.
c                s(   < \         SV `  ^ V^ V4      # )a=  
Create an axes locator callable for the specified cell.

Parameters
----------
ny, ny1 : int
    Integers specifying the row-position of the
    cell. When *ny1* is None, a single *ny*-th row is
    specified. Otherwise, location of rows spanning between *ny*
    to *ny1* (but excluding *ny1*-th row) is specified.
r   )r   rQ   rS   r   r   r   rW   ZVBoxDivider.new_locator3  s     w"1b!S11r   c                s6   W P                   ,          pW@P                   ,          pV P                  P                  P                  V P                  P                  ,          w  rxV P                  WV4      w  rrV P                  V4      pV P                  V4      p\        WWWWV P                  4       4	      w  ppppVf   RpTTppVVV,          V,          ,           VV,          VV,          ,
          V,          pp\        P                  P                  VVVV4      # r   )r   r   rY   rZ   r[   rE   r$   r!   rO   r2   r/   r0   r\   )r   rP   rQ   rR   rS   r_   r   r`   ra   rb   rc   rd   r7   Z	summed_hsZequal_wsrl   rk   rf   rg   rm   rn   ro   rp   r   r   rO   ZVBoxDivider._locateA  s    
ooyy~~**TYY]]:..t>
a++H5	,,X6 !	U4??;LNBB;CRBbfun$r#wB'75&@B++BB;;r   r4   r   r   r   r   r   r   r   -  s     
2< <r   r   c                 sd    \        V 4      pVP                  ^ ^ R7      pV P                  V4       V# )rG   r   )r   rW   r   )r_   dividerrV   s   &  r   make_axes_locatabler   R  s4    $G!!Q1!-G'"Nr   c                s^    Vf   . ROp\        V 4      pVf   T pVP                  WVR7       R# )a/  
Add auto-adjustable padding around *ax* to take its decorations (title,
labels, ticks, ticklabels) into account during layout, using
`.Divider.add_auto_adjustable_area`.

By default, padding is determined from the decorations of *ax*.
Pass *use_axes* to consider the decorations of other Axes instead.
N)rz   r{   r|   rv   )r   r~   )rC   rz   r{   r|   r   r}   r   make_axes_area_auto_adjustabler   Z  s<     8!"%G$$h1< % >r   )Nr   N)r   rN   Znumpyr   Z
matplotlibr   r    Zmatplotlib.gridspecr   Zmatplotlib.transformsZ
transformsr/   Z r   ry   r   r   r   rO   r   r   r   r   r4   r   r   <module>r      sx        + + HN HNV1AW 1AhN,' N,hB&<. &<R"<. "<J>r   