
    Mh<                       S SK Jr  S SKJr  S SKJr  S SKrS SKJr  S SK	rS SK
rS SKJr  S SKJr  S SKJrJrJr  \(       a.  S S	KJrJr  S S
KJr  S SKJr  S SKJr  S SKJr  S SK	Jr  S SK J!r!J"r"  SS jr#SS jr$SS jr% S    S!S jjr&  S"       S#S jjr'       S$         S%S jjr(S&S jr)S'S jr*                S(S jr+S)S jr,    S*     S+S jjr-S,S jr.S-S jr/g).    )annotations)ceil)TYPE_CHECKINGN)ticker)find_stack_level)is_list_like)ABCDataFrameABCIndex	ABCSeries)IterableSequence)Axes)Axis)Figure)Line2D)Table)	DataFrameSeriesc                P    [        U S5      (       d  gU R                  5       (       + $ )z+Whether fig has constrained_layout enabled.get_constrained_layoutF)hasattrr   )figs    S/var/www/html/env/lib/python3.13/site-packages/pandas/plotting/_matplotlib/tools.pydo_adjust_figurer   '   s%    3011))+++    c                J    [        U 5      (       a  U R                  " U0 UD6  gg)zCCall fig.subplots_adjust unless fig has constrained_layout enabled.N)r   subplots_adjust)r   argskwargss      r   maybe_adjust_figurer    .   s%    T,V, r   c                    U R                  5        H%  nUR                  S5        UR                  U5        M'     U R                  5       nUb  [	        USS9  g g )Nrightg?)bottom)get_xticklabelsset_horizontalalignmentset_rotation
get_figurer    )axrotlabelr   s       r   format_date_labelsr+   4   sR    ##%%%g.3 & --/C
C, r   c                .   [        U[        5      (       a  UR                  5       nO![        U[        5      (       a  O[	        S5      eUc  UR
                  nUc  UR                  nUR                  n[        R                  R                  " U 4UUUS.UD6$ )Nz&Input data must be DataFrame or Series)cellText	rowLabels	colLabels)

isinstancer   to_framer	   
ValueErrorindexcolumnsvalues
matplotlibtable)r(   datar.   r/   r   r-   s         r   r7   r7   ?   s     $	""}}	D,	'	'ABBJJ	LL	{{H !!
	
  r   c                :   Ub  [        U[        [        45      (       a  [        U5      S:w  a  [	        S5      eUu  p4US:X  a  US:  a  [        X-  5      U4=nu  p4O9US:X  a  US:  a  U[        X-  5      4=nu  p4OUS::  a  US::  a  Sn[	        U5      eX4-  U :  a  [	        SU SU SU  35      eU$ US	:X  a  g
US:X  a  SU 4$ US:X  a  U S4$ S
SSSS.n X`   $ ! [         a5    SnUS-  U :  a  US-  nUS-  U :  a  M  US-
  U-  U :  a  XwS-
  4s $ Xw4s $ f = f)N   z)Layout must be a tuple of (rows, columns)r   z1At least one dimension of layout must be positivez
Layout of xz# must be larger than required size single)   r>   
horizontalr>   vertical)r>   r:   )r:   r:   )r>   r:         )r0   tuplelistlenr2   r   KeyError)nplotslayoutlayout_typenrowsncolsmsglayoutsks           r   _get_layoutrO   \   s|   
 &5$-00CK14DHIIB;519%)&.%95$AAF\UEb[UQY%*D,@$AAF\UEaZEQJECS/!=6!UG1UG+NvhW  h		$6{	
	"{V6:G
 dVmFA dVm EQ;& 1u:4Ks   C #D DDDc           	        SSK Jn	  Uc  0 nUc  U	R                  " S0 UD6n
GO[        U5      (       a  U(       a  [	        U5      nUb"  [
        R                  " S[        [        5       S9  U(       d  U(       a"  [
        R                  " S[        [        5       S9  UR                  U :X  a   UR                  S   R                  5       n
X4$ [        SU  S35      eUR                  5       n
U S:X  a  U(       a  X4$ U
[	        U5      4$ [
        R                  " S	[        [        5       S9  U
R                  5         [        XUS
9u  pX-  n[        R                   " U["        S9nU
R$                  " XS40 UD6nU(       a  XS'   U(       a  XS'   XS'   ['        SU5       H>  nUR)                  5       nUU :  a
  SUS'   SUS'   U
R$                  " XUS-   40 UD6nX^U'   M@     X:w  a  XS  H  nUR+                  S5        M     [-        XXXU5        U(       a3  US:X  a	  US   nU
U4$ UR/                  X5      R1                  5       n U
U4$ UR/                  X5      nU
U4$ )a  
Create a figure with a set of subplots already made.

This utility wrapper makes it convenient to create common layouts of
subplots, including the enclosing figure object, in a single call.

Parameters
----------
naxes : int
  Number of required axes. Exceeded axes are set invisible. Default is
  nrows * ncols.

sharex : bool
  If True, the X axis will be shared amongst all subplots.

sharey : bool
  If True, the Y axis will be shared amongst all subplots.

squeeze : bool

  If True, extra dimensions are squeezed out from the returned axis object:
    - if only one subplot is constructed (nrows=ncols=1), the resulting
    single Axis object is returned as a scalar.
    - for Nx1 or 1xN subplots, the returned object is a 1-d numpy object
    array of Axis objects are returned as numpy 1-d arrays.
    - for NxM subplots with N>1 and M>1 are returned as a 2d array.

  If False, no squeezing is done: the returned axis object is always
  a 2-d array containing Axis instances, even if it ends up being 1x1.

subplot_kw : dict
  Dict with keywords passed to the add_subplot() call used to create each
  subplots.

ax : Matplotlib axis object, optional

layout : tuple
  Number of rows and columns of the subplot grid.
  If not specified, calculated from naxes and layout_type

layout_type : {'box', 'horizontal', 'vertical'}, default 'box'
  Specify how to layout the subplot grid.

fig_kw : Other keyword arguments to be passed to the figure() call.
    Note that all keywords not recognized above will be
    automatically included here.

Returns
-------
fig, ax : tuple
  - fig is the Matplotlib Figure object
  - ax can be either a single axis object or an array of axis objects if
  more than one subplot was created.  The dimensions of the resulting array
  can be controlled with the squeeze keyword, see above.

Examples
--------
x = np.linspace(0, 2*np.pi, 400)
y = np.sin(x**2)

# Just a figure and one subplot
f, ax = plt.subplots()
ax.plot(x, y)
ax.set_title('Simple plot')

# Two subplots, unpack the output array immediately
f, (ax1, ax2) = plt.subplots(1, 2, sharey=True)
ax1.plot(x, y)
ax1.set_title('Sharing Y axis')
ax2.scatter(x, y)

# Four polar axes
plt.subplots(2, 2, subplot_kw=dict(polar=True))
r   Nz6When passing multiple axes, layout keyword is ignored.)
stacklevelzoWhen passing multiple axes, sharex and sharey are ignored. These settings must be specified when creating axes.z"The number of passed axes must be z, the same as the output plotr>   zTTo output multiple subplots, the figure containing the passed axes is being cleared.)rH   rI   dtypesharexshareyF )matplotlib.pyplotpyplotfigurer   flatten_axeswarningswarnUserWarningr   sizeflatr'   r2   clearrO   npemptyobjectadd_subplotrangecopyset_visiblehandle_shared_axesreshapesqueeze)naxesrT   rU   rj   
subplot_kwr(   rH   rI   fig_kwpltr   rJ   rK   rG   axarrax0ikwdsaxess                      r   create_subplotsrt      sd   j $
	zjj"6"!"%!L/1
 X/1	 ww%ggaj++-w 8 @. . 
 mmoA:wL,,,MM4+-	 IIKuMLE]F HHV6*E //%
8Z
8C"8"8!H 1f  :!DN!DN__U1q59D9a  -BNN5!   ueE6J Q;8D 9 ==.668D
 9 }}U*9r   c                (   U R                  5        H  nUR                  S5        M     [        U R                  5       [        R
                  5      (       a$  U R                  [        R                  " 5       5        [        U R                  5       [        R                  5      (       a%  U R                  [        R                  " S5      5        U R                  5        H  nUR                  S5        M     U R                  5       R                  S5        g )NF )get_majorticklabelsrg   r0   get_minor_locatorr   NullLocatorset_minor_locatorAutoLocatorget_minor_formatterNullFormatterset_minor_formatterFormatStrFormatterget_minorticklabels	get_label)axists     r   _remove_labels_from_axisr   F  s    %%'	e (
 $((*F,>,>??v1134$**,f.B.BCC  !:!:2!>?%%'	e ( 	NN  'r   c                X   US:X  a  U R                  5       nO"US:X  a  U R                  5       nO[        S5      eUR                  U 5      nU R	                  5       R                  5       nU H<  n[        R                  " XER	                  5       R                  5       5      (       a  M<    g   g)a  
Return whether an axis is externally shared.

Parameters
----------
ax1 : matplotlib.axes.Axes
    Axis to query.
compare_axis : str
    `"x"` or `"y"` according to whether the X-axis or Y-axis is being
    compared.

Returns
-------
bool
    `True` if the axis is externally shared. Otherwise `False`.

Notes
-----
If two axes with different positions are sharing an axis, they can be
referred to as *externally* sharing the common axis.

If two axes sharing an axis also have the same position, they can be
referred to as *internally* sharing the common axis (a.k.a twinning).

_handle_shared_axes() is only interested in axes externally sharing an
axis, regardless of whether either of the axes is also internally sharing
with a third axis.
r<   yzD_has_externally_shared_axis() needs 'x' or 'y' as a second parameterTF)get_shared_x_axesget_shared_y_axesr2   get_siblingsget_position
get_pointsra   array_equal)ax1compare_axisrs   axes_siblings
ax1_pointsax2s         r   _has_externally_shared_axisr   V  s    : s$$&		$$&R
 	
 %%c*M !!#..0J~~j*:*:*<*G*G*IJJ  r   c                   US:  Ga  S nS nS n	US:  a   [         R                  " US-   US-   4[         R                  S9n
U  H#  nUR                  5       X" U5      U" U5      4'   M%     U  HN  nX" U5      S-   U" U5      4   (       d  M  U(       d  [	        US5      (       d  M9  [        UR                  5        MP     US:  aH  U  HA  nU	" U5      (       a  M  U(       d  [	        US5      (       d  M,  [        UR                  5        MC     g g g ! [         aM    S nU  HA  nU" U5      (       a  M  U(       d  [	        US5      (       d  M,  [        UR                  5        MC      Nf = f)	Nr>   c                J    U R                  5       R                  R                  $ N)get_subplotspecrowspanstartr<   s    r   <lambda>$handle_shared_axes.<locals>.<lambda>      A--/77==r   c                J    U R                  5       R                  R                  $ r   )r   colspanr   r   s    r   r   r     r   r   c                >    U R                  5       R                  5       $ r   )r   is_first_colr   s    r   r   r     s    !2!2!4!A!A!Cr   rR   r<   c                >    U R                  5       R                  5       $ r   )r   is_last_rowr   s    r   r   r     s    (9(9(;(G(G(Ir   r   )	ra   zerosbool_get_visibler   r   xaxis
IndexErroryaxis)ro   rG   rk   rJ   rK   rT   rU   row_numcol_numr   rH   r(   r   s                r   rh   rh     sL    z==C19; 519eai"8IB79~~7GF72;34    B "'"+/72;">? !<R!E!E0:  & 19  ##8SAA,RXX6  C .  ; JB"2 !<R!E!E0:	  	;s   BD 'D 7E'E'&E'c                   [        U 5      (       d  [        R                  " U /5      $ [        U [        R                  [
        45      (       a$  [        R                  " U 5      R                  5       $ [        R                  " U 5      $ r   )r   ra   arrayr0   ndarrayr
   asarrayravel)rs   s    r   rZ   rZ     sZ    xx	D2::x0	1	1zz$%%''88D>r   c                B   SS K Jn  [        U 5       H  nUb  UR                  UR	                  5       US9  Ub  UR                  UR	                  5       US9  Ub  UR                  UR                  5       US9  Uc  Mk  UR                  UR                  5       US9  M     U $ )Nr   )fontsize)rotation)rW   rX   rZ   setpr$   get_yticklabels)rs   
xlabelsizexrot
ylabelsizeyrotrn   r(   s          r   set_ticks_propsr     s     $4 !HHR'')JH?HHR'')DH9!HHR'')JH?HHR'')DH9 ! Kr   c                    U R                  5       n[        U S5      (       a  XR                  R                  5       -  n[        U S5      (       a  XR                  R                  5       -  nU$ )Nright_axleft_ax)	get_linesr   r   r   )r(   liness     r   get_all_linesr     sV    LLNEr:&&((r9%%''Lr   c                    [         R                  [         R                  * p!U  HR  nUR                  SS9n[        [         R                  " U5      U5      n[        [         R                  " U5      U5      nMT     X4$ )NF)orig)ra   inf	get_xdataminnanminmaxnanmax)r   leftr"   liner<   s        r   get_xlimr     s_    &&266'%NNN&299Q<&BIIaL%(  ;r   )r   r   returnbool)r   r   r   None)r(   r   r   r   )NN)r8   zDataFrame | Seriesr   r   )Nbox)rG   intrH   ztuple[int, int] | NonerI   strr   ztuple[int, int])FFTNNNr   )
rk   r   rT   r   rU   r   rj   r   rI   r   )r   r   r   r   )r   r   r   r   r   r   )ro   zIterable[Axes]rG   r   rk   r   rJ   r   rK   r   rT   r   rU   r   r   r   )rs   Axes | Sequence[Axes]r   z
np.ndarray)NNNN)rs   r   r   
int | Noner   r   )r(   r   r   zlist[Line2D])r   zIterable[Line2D]r   ztuple[float, float])0
__future__r   mathr   typingr   r[   r6   r   matplotlib.tablenumpyra   pandas.util._exceptionsr   pandas.core.dtypes.commonr   pandas.core.dtypes.genericr	   r
   r   collections.abcr   r   matplotlib.axesr   matplotlib.axisr   matplotlib.figurer   matplotlib.linesr   r   pandasr   r   r   r    r+   r7   rO   rt   r   r   rh   rZ   r   r   r   rV   r   r   <module>r      s   "        4 2  
 %$('&,-- =A 
> &*,,", , 	,h uuu u 	u up( /d272727 27 	27
 27 27 27 
27j "	!	
 	*	r   