
    MhUG                       S SK Jr  S SKJrJrJr  S SKrS SKJr  S SK	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  S SKrS SKJs  Jr  S SKJr  S SKJ r J!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+  S SK,J-r-  S SK.J/r/  S SK0J1r1  S SK2J3r3  SS jr4 " S S\ 5      r5SS jr6        S     S S jjr7         S!       S"S jjr8         S!       S"S jjr9          S#             S$S jjr:g)%    )annotations)TYPE_CHECKINGLiteral
NamedTupleN)setp)lib)cache_readonly)find_stack_level)is_dict_like)	ABCSeries)remove_na_arraylike)pprint_thing)LinePlotMPLPlot)create_iter_data_given_by)get_standard_colors)create_subplotsflatten_axesmaybe_adjust_figure)
Collection)Axes)Figure)Line2D)MatplotlibColorc                @   U(       a  U R                  5       OU R                  5       n[        U5      [        U5      :w  a1  [        [        U5      [        U5      5      u  pVUS:X  d   U5       eX-  nU(       a  U R                  " U40 UD6  gU R
                  " U40 UD6  g)zSet the tick labels of a given axis.

Due to https://github.com/matplotlib/matplotlib/pull/17266, we need to handle the
case of repeated ticks (due to `FixedLocator`) and thus we duplicate the number of
labels.
r   N)
get_xticks
get_ytickslendivmodset_xticklabelsset_yticklabels)axlabelsis_verticalkwargsticksi	remainders          U/var/www/html/env/lib/python3.13/site-packages/pandas/plotting/_matplotlib/boxplot.py_set_ticklabelsr*   /   s      +BMMOE
5zS[ c%j#f+6A~(y(~
6,V,
6,V,    c                  @  ^  \ rS rSr\SS j5       rSrSr " S S\5      r	SSS jjr
\ S     SS jj5       rS	 r\S
 5       r\S 5       r\S 5       r\S 5       r\S 5       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 j5       r\U 4S j5       rSrU =r$ )"BoxPlotA   c                    g)Nbox selfs    r)   _kindBoxPlot._kindB   s    r+   
horizontal)Naxesdictbothc                  *    \ rS rSr% S\S'   S\S'   Srg)
BoxPlot.BPJ   r   r"   zdict[str, list[Line2D]]linesr1   N)__name__
__module____qualname____firstlineno____annotations____static_attributes__r1   r+   r)   BPr;   J   s    &&r+   rD   c                    X R                   ;  a  [        S5      eX l        [        R                  " X40 UD6  U R
                  (       a   U R                  S:X  a  SU l        g SU l        g g )Nz2return_type must be {None, 'axes', 'dict', 'both'}verticalF)	_valid_return_types
ValueErrorreturn_typer   __init__subplotsorientationsharexsharey)r3   datarI   r%   s       r)   rJ   BoxPlot.__init__O   s]    666QRR&.v.== :-## r+   c                |   UR                   S:X  ab  U Vs/ s H  n[        U5      PM     nnU Vs/ s H9  ofR                  S:  a  UO$[        R                  " [        R
                  /5      PM;     nnO[        U5      nUR                  " U40 UD6nUS:X  a  X4$ US:X  a  U R                  XS9U4$ X4$ s  snf s  snf )N   r   r8   r9   r"   r=   )ndimr   sizenparraynanboxplotrD   )	clsr"   y
column_numrI   kwdsvysbps	            r)   _plotBoxPlot._plot`   s    
 66Q;234!Q%a(!B4 DFF2avvz!rxx'992BFB$Q'BZZ#d#& 6MF"66R6*B..6M 5 Gs   B4A B9c                    U[         R                  L a  g Ub  [        R                  " S[	        5       S9  [        U[        5      (       a#  / SQnU H  nXC;  d  M
  [        SU SU 35      e   U$ )NzC'color' and 'colormap' cannot be used simultaneously. Using 'color')
stacklevelboxeswhiskersmedianscaps!color dict contains invalid key ''. The key must be either )r   
no_defaultwarningswarnr
   
isinstancer8   rH   )r3   colorcolormap
valid_keyskeys        r)   _validate_color_argsBoxPlot._validate_color_argsv   s}    CNN"MM0+- eT""AJ($;C5 A22<?   r+   c                ,    [        SU R                  S S9$ )N   )
num_colorsrq   rp   )r   rq   r2   s    r)   _color_attrsBoxPlot._color_attrs   s     #a$--tTTr+   c                     U R                   S   $ Nr   ry   r2   s    r)   _boxes_cBoxPlot._boxes_c         ##r+   c                     U R                   S   $ r|   r}   r2   s    r)   _whiskers_cBoxPlot._whiskers_c   r   r+   c                     U R                   S   $ )NrR   r}   r2   s    r)   
_medians_cBoxPlot._medians_c   r   r+   c                     U R                   S   $ r|   r}   r2   s    r)   _caps_cBoxPlot._caps_c   r   r+   c                    g Nr1   )r3   rx   
color_kwdss      r)   _get_colorsBoxPlot._get_colors   s     	r+   c                   [        U R                  [        5      (       a  U R                  R                  SU R                  5      nU R                  R                  SU R
                  5      nU R                  R                  SU R                  5      nU R                  R                  SU R                  5      nO|U R                  =(       d    U R                  nU R                  =(       d    U R
                  nU R                  =(       d    U R                  nU R                  =(       d    U R                  nX#XE4n[        U4SU0U R                  D6  g )Nrf   rg   rh   ri   	color_tup)
ro   rp   r8   getr~   r   r   r   maybe_color_bpr]   )r3   r`   rf   rg   rh   ri   r   s          r)   r   BoxPlot.maybe_color_bp   s    djj$''JJNN7DMM:Ezz~~j$2B2BCHjjnnY@G::>>&$,,7D JJ/$--Ezz5T%5%5Hjj3DOOG::-Dg4	r<Y<$))<r+   c                P   U R                   (       Ga}  [        R                  " [        S9U l        U R
                  b   [        U R                  U R                  5      OU R                  n[        U R                  US95       GH	  u  nu  pEU R                  U5      nU R                  R                  5       nU R
                  be  UR                  nUR                  [!        U5      5        U R                  R"                  R$                  nUS    V	s/ s H  n	[!        U	5      PM     n
n	O[!        U5      /n
U R&                  " Xe4X0R(                  S.UD6u  pU R+                  U5        XR                  U'   [-        XjU R.                  S:H  S9  GM     g U R                  R0                  R                  nU R                  S5      nU R                  R                  5       nU R&                  " Xe4SU R(                  S.UD6u  pU R+                  U5        Xl        U R                  R"                   Vs/ s H  n[!        U5      PM     nnU R2                  (       d-  [5        [7        U5      5       Vs/ s H  n[!        U5      PM     nn[-        XnU R.                  S:H  S9  g s  sn	f s  snf s  snf )Ndtype)rO   r   )r\   rI   rF   )r"   r#   r$   )rK   pdSeriesobject_return_objbyr   rO   r4   	enumerate
_iter_data_get_axr]   copyT	set_titler   columnslevelsra   rI   r   r*   rL   values	use_indexranger   )r3   figrO   r'   labelr[   r"   r]   r   col
ticklabelsretr`   leftr#   rs   s                   r)   
_make_plotBoxPlot._make_plot   s<   ===!yyv6D
 77& *$))TZZ@YY  "+4???+E!F:E\\!_yy~~' 77&ALLe!45
 "YY..55F?Eay!Iy,s"3yJ!IJ".u"5!6J**&'5E5EIM ##B'*-  '$:J:Jj:X/ "G6 		  ""AaB99>>#Djj"#1A1AEIGC #"59YY5F5FG5FTl4(5FFG>>7<S[7IJ7I,s+7IJ$2B2Bj2P5 "J. HJs   J,J*J#c                    g r   r1   r2   s    r)   _make_legendBoxPlot._make_legend   s    r+   c                    U R                   (       a$  UR                  [        U R                   5      5        U R                  (       a%  UR	                  [        U R                  5      5        g g r   )xlabel
set_xlabelr   ylabel
set_ylabel)r3   r"   rO   s      r)   _post_plot_logicBoxPlot._post_plot_logic   s?    ;;MM,t{{34;;MM,t{{34 r+   c                H    U R                   R                  SS5      (       a  gg)NvertTrF   r6   )r]   r   r2   s    r)   rL   BoxPlot.orientation  s    99==&&r+   c                J   > U R                   c
  [        TU ]  $ U R                  $ r   )rI   superresultr   )r3   	__class__s    r)   r   BoxPlot.result	  s%    #7>!###r+   )r   rI   rM   rN   )returnzLiteral['box'])r7   )rI   strr   None)Nr7   )r"   r   r[   z
np.ndarrayrI   r   )Nrp   )r   zQdict[str, MatplotlibColor] | MatplotlibColor | Collection[MatplotlibColor] | Noner   r   r   r   )r   r   r   r   )r"   r   r   r   )r   z!Literal['horizontal', 'vertical'])r>   r?   r@   rA   propertyr4   _layout_typerG   r   rD   rJ   classmethodra   rt   r	   ry   r~   r   r   r   r   r   r   r   r   rL   r   rC   __classcell__)r   s   @r)   r-   r-   A   s-      L8'Z '
$" JP$DG ** U U $ $ $ $ $ $ $ $
   
="8t5     $ $r+   r-   c                >   UR                  S5      (       d  [        U S   US   SS9  UR                  S5      (       d  [        U S   US   SS9  UR                  S5      (       d  [        U S	   US
   SS9  UR                  S5      (       d  [        U S   US   SS9  g g )Nboxpropsrf   r      )rp   alphawhiskerpropsrg   medianpropsrh   rR   cappropsri   rw   )r   r   )r`   r   r]   s      r)   r   r     s     88JR[	!A688N##R
^9Q<q988M""R	])A,a888JRZy|15  r+   c
           	     j   UR                  USS9nUcG  [        U[        [        45      (       d  U/nUR	                  5       R
                  R                  U5      n[        U5      n[        UU
R                  SS5      U
R                  SS5      UUUS9u  p[        U5      nU
R                  SS 5      U
R                  SS 5      nnU
R                  S	S5      (       a  U=(       d    UnOU=(       d    Un/ n[        U5       H\  u  nnUU   nUU   n[        U6 u  nnU " UUU4UUS
.U
D6nUR                  U5        UR                  U5        UR!                  U5        M^     ["        R$                  " UUSS9nU	c  Un[        U5      S:X  a  US   OUnUR'                  SU 35        [)        USSSSSS9  U$ )NF)observedrM   TrN   )naxesrM   rN   figsizer"   layoutr   r   r   )r   r   )indexr   r   r   zBoxplot grouped by 333333??皙?皙?bottomtopr   rightwspace)groupbyro   listtuple_get_numeric_datar   
differencer   r   popr   r   r   zipr   appendgridr   r   suptitler   )plotfrO   r   r   numeric_onlyr   r   r"   r   rI   r%   groupedr   r   r7   _axesr   r   	ax_valuesr'   r   gp_colkeysr   re_plotfr   bylines                              r)   _grouped_plot_by_columnr     s    ll2l.G"tUm,,B((*22==bALEzz(D)zz(D)IC E ZZ$/Hd1KFFzz&$22IG$31XF|fvrR&R6R
S"
 % YYye<F "glRUFLL&vh/0Dc3sSMr+   c
                  ^^^	^
^ SS K Jn  T	[        R                  ;  a  [	        S5      e[        U [        5      (       a  U R                  S5      n SnU
4S jnSUUU	U4S jjnU" 5       mUc  S nO![        U[        [        45      (       a  UnOU/nUb  [        UU 4UUUUUUT	S.T
D6nU$ T	c  Sm	Ub  [	        S5      eUc3  Ub  S	U0O0 nUR                  U5         UR                  5       nS S S 5        U R                  5       n [        U R                  5      nUS:X  a  [	        S
5      eUc  U R                  nOX   n U" XR                   R"                  U40 T
D6nUR%                  U5        U$ ! , (       d  f       N= f)Nr   z,return_type must be {'axes', 'dict', 'both'}xc                   > [        SS9n [        R                  " U / SQ5      n [        R                  " U S5      n TR	                  SS 5      nU(       az  [        U5      (       aY  / SQn[        [        U[        S5      5      5      nUR                  5        H!  u  pEXB;   a  XPX4   '   M  [        SU S	U 35      e   U $ U R                  U5        U $ )
Nrw   )rx   )r   r   rR   krp   re      rj   rk   )r   rV   taker   r   r   r8   r   r   itemsrH   fill)r   colorsrr   key_to_indexrs   valuer]   s         r)   r   boxplot.<locals>._get_colorsr  s     %2+63''4(F## F
#C
E!H$=>"(,,.JC(49|01(?u E66@\C 	 #1  F#r+   c                `  > UR                  SS 5      UR                  SS 5      pTU(       a  UR                  [        U5      5        U(       a  UR                  [        U5      5        U  Vs/ s H  n[        U5      PM     n nU Vs/ s H%  n[        R
                  " [        U5      [        S9PM'     nnUR                  " U40 UD6nT
b  UR                  ST
S9  [        X UR                  SS5      TS9  [        U4S	T	0UD6  TS
:X  a  U$ TS:X  a  [        R                  X(S9$ U$ s  snf s  snf )Nr   r   r   r9   )axis	labelsizer   T)r"   r#   r$   rotationr   r8   rS   )r   r   r   r   rV   asarrayr   r   rY   tick_paramsr*   r   r   r-   rD   )r   r   r"   r]   r   r   r   r^   r`   r   fontsizerI   rots            r)   
plot_groupboxplot.<locals>.plot_group  s   (D1488Hd3KMM,v./MM,v./)-.AQ.LRSFq"**036BFSZZ'$'NN(N; 	DHHVT,BS	
 	r4V4t4 & IF":::..I% /Ss   +D&,D+)r   r   r   r   r"   r   rI   r7   z7The 'layout' keyword is not supported when 'by' is Nonezfigure.figsizez;boxplot method requires numerical columns, nothing to plot.)r"   r   )matplotlib.pyplotpyplotr-   rG   rH   ro   r   to_framer   r   r   
rc_contextgcar   r   r   r   r   r   )rO   columnr   r"   r  r  r   r   r   rI   r]   pltr   r  r   r   rcr   r   s       ``   ``       @r)   rY   rY   [  s    $ '555GHH$	""}}S!: 8 ]F~	FT5M	*	*(	~ )
 #
 
H M/  KVWW:070C"G,B#WWY $%%'DLL!A:M  ?llG=DG[[]]B?$?
M! $#s   E00
E>c
                ^    SS K Jn  [        U 4UUUUUUUUU	S.	U
D6nUR                  5         U$ )Nr   )	r  r   r"   r  r   r  r   r   rI   )r	  r
  rY   draw_if_interactive)r3   r  r   r"   r  r  r   r   r   rI   r]   r  s               r)   boxplot_framer    sQ     $	

 
B Ir+   c                   USL a  [        U 5      n[        USUU	U
UUS9u  p[        U5      n[        R                  " [
        S9n[        X5       HH  u  u  nnnUR                  " SXbX4US.UD6nUR                  [        U5      5        UUR                  U'   MJ     [        USSSSS	S
9  U$ [        U 6 u  nnU R                  S:X  a  [        R                  " UUSS9nO,[        U5      S:  a  US   R                  USS  5      nOUS   nUbL  [        R                   " U5      n[        R"                  R%                  UU/5      n['        UR(                  5      nUR                  " SUUUUUUUS.UD6nU$ )NTF)r   squeezer"   rM   rN   r   r   r   )r"   r  r  r  r   r   r   r   r   r   r   r   )r   r   )r  r  r  r   r"   r   r   r1   )r   r   r   r   r   r   r   rY   r   r   locr   r   concatjoincomconvert_to_list_like
MultiIndexfrom_productr   r   )r   rK   r  r  r  r   r"   r   r   rM   rN   r]   r   r   r7   r   rs   groupdr   framesdf	multi_keys                          r)   boxplot_frame_groupbyr"    s    4G#
	 D!iif% #G 2LS%" xtOSA LLc*+CGGCL !3 	C#CsSVW8 J5 G}f<<1615B[1_qs,BB --f5F22D&>BI)**+Fjj 	
	
 	
 Jr+   )r"   r   r#   z	list[str]r$   boolr   r   r   )NNTFNNNN)r   r#  r   r#  r   tuple[float, float] | None)	NNNNr   TNNN)r  
int | Noner  intr   r#  r   r$  )
TNNr   TNNNFT)rK   r#  r  r%  r  r&  r   r#  r   r$  rM   r#  rN   r#  );
__future__r   typingr   r   r   rm   matplotlib.artistr   numpyrV   pandas._libsr   pandas.util._decoratorsr	   pandas.util._exceptionsr
   pandas.core.dtypes.commonr   pandas.core.dtypes.genericr   pandas.core.dtypes.missingr   pandasr   pandas.core.commoncorecommonr  pandas.io.formats.printingr    pandas.plotting._matplotlib.corer   r   #pandas.plotting._matplotlib.groupbyr   !pandas.plotting._matplotlib.styler   !pandas.plotting._matplotlib.toolsr   r   r   collections.abcr   matplotlib.axesr   matplotlib.figurer   matplotlib.linesr   pandas._typingr   r*   r-   r   r   rY   r  r"  r1   r+   r)   <module>r?     s   " 
  "   2 4 2 0 :      3 J A  *$('.-$M$h M$`
6  *.:
 : : (:~ *.
  
  (H *.
  
  (D *.?? 	?
 
? ? (? ? ?r+   