+
    xȇiD                    H   R t ^ RIHt ^ RIHt ^ RIt^ RIHt ^ RI	t
^ RI	Ht ^ RIHt ]'       d   ^ RIHt ^ RIHt R!R ltR!R	 ltR
 tR"R ltR"R R lltR tR#R ltR tR$R ltR%R ltR#R ltR R ltR&R ltR!R lt R'R lt!R(R lt"R t#R t$R R lt%R)R lt&R t'R  t(R# )*zF
Module consolidating common testing functions for checking plotting.
)annotations)TYPE_CHECKINGN)is_list_like)Series)SequenceAxesc                   V'       d   Vf   \        R4      h\        V 4      p V  F]  pV'       d?   VP                  4       f   Q h\        VP                  4       P	                  4       V4       KI  VP                  4       f   K]  Q h	  R# )a  
Check each axes has expected legend labels

Parameters
----------
axes : matplotlib Axes object, or its list-like
labels : list-like
    expected legend labels
visible : bool
    expected legend visibility. labels are checked only when visible is
    True
Nz-labels must be specified when visible is True)
ValueError_flatten_visible
get_legend_check_text_labels	get_texts)axeslabelsvisibleaxs   &&& l/Users/max/.openclaw/workspace/postharvest/venv/lib/python3.14/site-packages/pandas/tests/plotting/common.py_check_legend_labelsr      sk     FNHIID!D==?...r}}88:FC==?***     c                    V'       d   Vf   \        R4      hV'       d;   V P                  4       w  r4V Uu. uF  qUP                  4       NK  	  ppWa8X  g   Q hR# V P                  4       e   Q hR# u upi )z
Check ax has expected legend markers

Parameters
----------
ax : matplotlib Axes object
expected_markers : list-like
    expected legend markers
visible : bool
    expected legend visibility. labels are checked only when visible is
    True
Nz.Markers must be specified when visible is True)r
   get_legend_handles_labels
get_markerr   )r   expected_markersr   handles_handlemarkerss   &&&    r   _check_legend_markerr   /   sj     $,IJJ113
5<=W6$$&W=***}}&&& >s   A0c                   V P                  4       pVP                  4       p\        V4      \        V4      8X  g   Q h\        W#RR7       F;  w  rEVP                  4       pVP                  4       p\        P
                  ! Wg4       K=  	  R# )zt
Check each axes has identical lines

Parameters
----------
xp : matplotlib Axes object
rs : matplotlib Axes object
TstrictN)	get_lineslenzip
get_xydatatmassert_almost_equal)xprsxp_linesrs_linesxplrslxpdatarsdatas   &&      r   _check_datar0   F   si     ||~H||~Hx=CM)))48!!
v. 9r   c                    ^ RI Hp \        W4      '       g   \        V 4      '       g   V .p V  F  pVP	                  4       V8X  d   K  Q h	  R# )z
Check each artist is visible or not

Parameters
----------
collections : matplotlib Artist or its list-like
    target Artist or its list or collection
visible : bool
    expected visibility
)
CollectionN)matplotlib.collectionsr2   
isinstancer   get_visible)collectionsr   r2   patchs   &&  r   _check_visibler8   Y   sD     2k..|K7P7P"m  "g--- r   c               $    V ^8  d   QhRRRRRR/# )   r   Axes | Sequence[Axes]filledboolreturnNone )formats   "r   __annotate__rB   m   s#     ( ($9 (4 (SW (r   c                z    \        V 4      p V  F)  pVP                   F  pVP                  V8X  d   K  Q h	  K+  	  R# )z
Check for each artist whether it is filled or not

Parameters
----------
axes : matplotlib Axes object, or its list-like
filled : bool
    expected filling
N)r   patchesfill)r   r<   r   r7   s   &&  r   _check_patches_all_filledrF   m   s8     D!DZZE::'''   r   c                    V P                  4       p\        \        W!4      4      pV P                   Uu. uF  qCV,          NK  	  up# u upi N)uniquedictr$   values)seriescolorsrI   mappedvs   &&   r   _get_colors_mappedrP   ~   s>    ]]_F #f%&F%}}-}!1II}---s   Ac                   ^ RI Hp ^ RIHpHpHp ^ RIHp VP                  p	Ve   Ve   \        W14      pVR\        V 4       p\        V 4      \        V4      8X  g   Q h\        WRR7       F  w  r\        W4      '       d#   V
P                  4       pV	P                  V4      pMD\        WV34      '       d"   \        V
P!                  4       ^ ,          4      pMV
P!                  4       pV	P                  V4      pW8X  d   K  Q h	  Ve   Ve   \        W24      pVR\        V 4       p\        V 4      \        V4      8X  g   Q h\        WRR7       F  w  r\        W4      '       d   V
P#                  4       ^ ,          pMV
P#                  4       p\        V\$        P&                  4      '       d   \        V4      pV	P                  V4      pW8X  d   K  Q h	  R# R# )a  
Check each artist has expected line colors and face colors

Parameters
----------
collections : list-like
    list or collection of target artist
linecolors : list-like which has the same length as collections
    list of expected line colors
facecolors : list-like which has the same length as collections
    list of expected face colors
mapping : Series
    Series used for color grouping key
    used for andrew_curves, parallel_coordinates, radviz test
)rM   )r2   LineCollectionPolyCollection)Line2DNTr    )
matplotlibrM   r3   r2   rR   rS   matplotlib.linesrT   ColorConverterrP   r#   r$   r4   	get_colorto_rgbatupleget_edgecolorget_facecolornpndarray)r6   
linecolors
facecolorsmappingrM   r2   rR   rS   rT   convr7   colorresultexpecteds   &&&&          r   _check_colorsrf      s     " 
 (  D+G@J#$6c+&67J;3z?222ELE%((*f-EN#CDDu224Q78,,.||E*H%%% F +G@J#$6c+&67J;3z?222ELE%,,,,.q1,,.&"**--v||E*H%%% F r   c                   \        V 4      '       g   V P                  4       V8X  g   Q hR# V  Uu. uF  q"P                  4       NK  	  pp\        V4      \        V4      8X  g   Q h\        W1RR7       F  w  rEWE8X  d   K  Q h	  R# u upi )z
Check each text has expected labels

Parameters
----------
texts : matplotlib Text object, or its list-like
    target text, or its list
expected : str or list-like which has the same length as texts
    expected text label, or its list
Tr    N)r   get_textr#   r$   )textsre   tr   labeles   &&    r   r   r      st     ~~8+++(-.1**,.6{c(m+++FT:HE:: ; /s   Bc                ^   ^ RI Hp \        V 4      p V  EF  pVf   Ve   \        VP                  P                  4       V4      '       d   VP                  4       pM'VP                  4       VP                  RR7      ,           pV FW  pVe&   \        P                  ! VP                  4       V4       Vf   K2  \        P                  ! VP                  4       V4       KY  	  Vf   Vf   K  \        VP                  P                  4       V4      '       d   VP                  4       pM'VP                  4       VP                  RR7      ,           pV FW  pVe&   \        P                  ! VP                  4       V4       Vf   K2  \        P                  ! VP                  4       V4       KY  	  EK  	  R# )a/  
Check each axes has expected tick properties

Parameters
----------
axes : matplotlib Axes object, or its list-like
xlabelsize : number
    expected xticks font size
xrot : number
    expected xticks rotation
ylabelsize : number
    expected yticks font size
yrot : number
    expected yticks rotation
)NullFormatterNT)minor)matplotlib.tickerrn   r   r4   xaxisget_minor_formatterget_xticklabelsr&   r'   get_fontsizeget_rotationyaxisget_yticklabels)	r   
xlabelsizexrot
ylabelsizeyrotrn   r   r   rk   s	   &&&&&    r   _check_ticks_propsr|      sW     0D!D!T%5"((668-HH ++-++-0B0B0B0NN)**5+=+=+?L#**5+=+=+?F	   !T%5"((668-HH++-++-0B0B0B0NN)**5+=+=+?L#**5+=+=+?F	  + r   c                    \        V 4      p V  FE  pVP                  P                  4       V8X  g   Q hVP                  P                  4       V8X  d   KE  Q h	  R# )z
Check each axes has expected scales

Parameters
----------
axes : matplotlib Axes object, or its list-like
xaxis : {'linear', 'log'}
    expected xaxis scale
yaxis : {'linear', 'log'}
    expected yaxis scale
N)r   rq   	get_scalerv   )r   rq   rv   r   s   &&& r   _check_ax_scalesr   	  sN     D!Dxx!!#u,,,xx!!#u,,, r   c                   ^ RI Hp Vf   Rp\        V 4      pVe<   \        V4      V8X  g   Q hV F#  p\        VP	                  4       4      ^ 8  d   K#  Q h	  Ve   \        4       p\        4       pV! V 4       F_  pVP                  4       P                  4       p	VP                  V	^ ,          ^ ,          4       VP                  V	^ ,          ^,          4       Ka  	  \        V4      \        V4      3p
W8X  g   Q h\        P                  ! V^ ,          P                  P                  4       \        P                  ! V\        P                  R7      4       R# )an  
Check expected number of axes is drawn in expected layout

Parameters
----------
axes : matplotlib Axes object, or its list-like
axes_num : number
    expected number of axes. Unnecessary axes should be set to
    invisible.
layout : tuple
    expected layout, (expected number of rows , columns)
figsize : tuple
    expected figsize. default is matplotlib default
flatten_axesN)dtype)g@g333333@)!pandas.plotting._matplotlib.toolsr   r   r#   get_childrensetget_position
get_pointsaddr&   assert_numpy_array_equalfigureget_size_inchesr]   arrayfloat64)r   axes_numlayoutfigsizer   visible_axesr   x_sety_setpointsrd   s   &&&&       r   _check_axes_shaper     s    ?#D)L< H,,,Br()A---  t$B__&113FIIfQil#IIfQil#	 %
 e*c%j)Q..0


+r   c                    V ^8  d   QhRRRR/# )r:   r   r;   r>   zSequence[Axes]r@   )rA   s   "r   rB   rB   G  s      0 ^ r   c                |    ^ RI Hp V! V 4      pV Uu. uF  q3P                  4       '       g   K  VNK  	  p pV # u upi )zo
Flatten axes, and filter only visible

Parameters
----------
axes : matplotlib Axes object, or its list-like

r   )r   r   r5   )r   r   axes_ndarrayr   s   &   r   r   r   G  s8     ?%L%:2)9BBD:K ;s   99c                    \        V 4      p V  Fj  pVP                  p^ p^ pV FA  p\        VRR4      p\        VRR4      p	V'       d
   V^,          pV	'       g   K8  V^,          pKC  	  W8X  g   Q hW&8X  d   Kj  Q h	  R# )z
Check axes has expected number of errorbars

Parameters
----------
axes : matplotlib Axes object, or its list-like
xerr : number
    expected number of x errorbar
yerr : number
    expected number of y errorbar
has_xerrFhas_yerrN)r   
containersgetattr)
r   xerryerrr   r   
xerr_count
yerr_countcr   r   s
   &&&       r   _check_has_errorbarsr   W  s     D!D]]


Aq*e4Hq*e4Ha
xa
  !!!!!! r   c                    ^ RI Hp R\        RVR\        /pVfl   Vf   Rp\	        WV,          4      '       g   Q hVR8X  dC   \	        V P
                  V4      '       g   Q h\	        V P                  \        4      '       g   Q hR# R# Vf(   \        V 4       F  p\	        Wd4      '       d   K  Q h	  R# \	        V \        4      '       g   Q h\        V P                  4       4      \        V4      8X  g   Q hV P                  4        EF  w  rx\	        WV,          4      '       g   Q hVR8X  d$   V'       d   VP                  4       V8X  g   Q hKH  KJ  VR8X  dl   V'       d"   VP
                  P                  4       V8X  g   Q h\	        VP
                  V4      '       g   Q h\	        VP                  \        4      '       g   Q hK  VR8X  dB   VR,          ^ ,          p	V	P                  p
V'       d   V
P                  4       V8X  g   Q hEK  EK  \        h	  R# )a  
Check box returned type is correct

Parameters
----------
returned : object to be tested, returned from boxplot
return_type : str
    return_type passed to boxplot
expected_keys : list-like, optional
    group labels in subplot case. If not passed,
    the function checks assuming boxplot uses single ax
check_ax_title : bool
    Whether to check the ax.title is the same as expected_key
    Intended to be checked by calling from ``boxplot``.
    Normal ``plot`` doesn't attach ``ax.title``, it must be disabled.
r   rJ   r   bothNmedians)matplotlib.axesr   rJ   rZ   r4   r   linesr   r   sortedkeysitems	get_titler   AssertionError)returnedreturn_typeexpected_keyscheck_ax_titler   typesrkeyvalueliner   s   &&&&       r   _check_box_return_typer   s  s   & %T647E K(+$67777& hkk40000hnnd3333 !
 %h/!!**** 0(F++++hmmo&&*????"..*JCe;%78888f$! ??,333 "&! 88--/3666!%((D1111!%++t4444&Y'*yy!>>+s222 " %$# +r   c                  a ^ RI oV3R lpVf   / p^pV EF*  pSP                  P                  ^^\        V4      ,          V4       V^,          pSP	                  RRR7       V P
                  ! R	RV/VB  V! 4       '       d   Q hSP                  P                  4        SP                  P                  ^^\        V4      ,          V4       V^,          pSP	                  RRR7       V P
                  ! R	RVRR/VB  V! 4       '       d   Q hSP                  P                  4        VR
9  g   EK  SP                  P                  ^^\        V4      ,          V4       V^,          pSP	                  RRR7       V P
                  ! R	RV/VB  V! 4       '       g   Q hSP                  P                  4        SP                  P                  ^^\        V4      ,          V4       V^,          pSP	                  RRR7       V P
                  ! R	RVRR/VB  V! 4       '       g   Q hSP                  P                  4        EK-  	  R# )    Nc                   < SP                   P                  4       P                  P                  4       p SP                   P                  4       P                  P                  4       p\
        ;QJ d    R  V  4       F  '       d   K   RM	  RM! R  V  4       4      p\
        ;QJ d    R V 4       F  '       d   K   RM	  RM! R V 4       4      pT;'       d    T'       * # )c              3  ^   "   T F#  qP                   P                  4       '       * x  K%  	  R # 5irH   gridliner5   .0gs   & r   	<genexpr>;_check_grid_settings.<locals>.is_grid_on.<locals>.<genexpr>  !     @Azz--///   +-FTc              3  ^   "   T F#  qP                   P                  4       '       * x  K%  	  R # 5irH   r   r   s   & r   r   r     r   r   )pyplotgcarq   get_major_ticksrv   all)xticksyticksxoffyoffmpls       r   
is_grid_on(_check_grid_settings.<locals>.is_grid_on  s    !''779!''779s@@sss@@@s@@sss@@@MMT""r   r   F)gridkindTr   r@   )piehexbinscatter)rU   r   subplotr#   rcplotclf)objkindskwsr   spndxr   r   s   &&&   @r   _check_grid_settingsr     s    # {E

1a#e*ne4
vE""d"c"<<



1a#e*ne4
vD!.d..#.<<

33JJq!c%j.%8QJEFF6F%HH&$&#&<<<JJNNJJq!c%j.%8QJEFF6F&HH1$1T1S1<<<JJNN9 r   c                J    V R,           Uu. uF  q"V,          NK  	  up# u upi )zD
Auxiliary function for correctly unpacking cycler after MPL >= 1.5
zaxes.prop_cycler@   )rcParamsfieldrO   s   && r   _unpack_cyclerr     s(     ''89:9eHH9:::s    c                (    V P                   R ,          # )x_shared_axesr   s   &r   
get_x_axisr         ??3r   c                (    V P                   R ,          # )yr   r   s   &r   
get_y_axisr     r   r   c                   V ^8  d   QhRR/# )r:   r>   r?   r@   )rA   s   "r   rB   rB     s     < < <r   c                   ^ RI Hp ^ RIHp \	        V \
        \        P                  34      '       dt   \	        V \
        4      '       d   V P                  p V P                  R4       F:  pR\        V4      P                  : 2p\	        W2\        34      '       d   K5  Q V4       h	  R# R\        V 4      P                  : 2p\	        W\        \        34      '       g   Q V4       hR# )r   )Artistr   zBone of 'objs' is not a matplotlib Axes instance, type encountered zoobjs is neither an ndarray of Artist instances nor a single ArtistArtist instance, tuple, or dict, 'objs' is a N)matplotlib.artistr   r   r   r4   r   r]   r^   _valuesreshapetype__name__rJ   rZ   )objsr   r   elmsgs   &    r   "assert_is_valid_plot_return_objectr     s    ($$,--dF##<<D,,r"B$$(H$5$5#8:  b,//44/ #BDz""%' 	
 $ 566;;6r   c                    ^ RI Hp V'       d   \        pM\        pRpVP	                  RVP                  4       4      pVP                  4        V! W3/ VB  F  p\        V4       K  	  V# )a{  
Create plot and ensure that plot return object is valid.

Parameters
----------
f : func
    Plotting function.
default_axes : bool, optional
    If False (default):
        - If `ax` not in `kwargs`, then create subplot(211) and plot there
        - Create new subplot(212) and plot there as well
        - Mind special corner case for bootstrap_plot (see `_gen_two_subplots`)
    If True:
        - Simply run plotting function with kwargs provided
        - All required axes instances will be created automatically
        - It is recommended to use it when the plotting function
        creates multiple axes itself. It helps avoid warnings like
        'UserWarning: To output multiple subplots,
        the figure containing the passed axes is being cleared'
**kwargs
    Keyword arguments passed to the plotting function.

Returns
-------
Plot object returned by the last plotting.
Nr   )matplotlib.pyplotr   _gen_default_plot_gen_two_subplotsgetgcfr   r   )fdefault_axeskwargsplt	gen_plotsretfigs   &&,    r   _check_plot_worksr    s[    6 $%	%	
C
**Xswwy
)CGGI*6**3/ + Jr   c              +  "   "   V ! R/ VB x  R# 5i)z
Create plot in a default way.
Nr@   r@   r  r  r  s   &&,r   r   r   0  s      +f+s   c              +     "   RV9  d   VP                  ^4       V ! R/ VB x  V \        P                  P                  J d   RV9  g   Q hMVP                  ^4      VR&   V ! R/ VB x  R# 5i)z1
Create plot on two subplots forcefully created.
r   Nr@   )add_subplotpdplottingbootstrap_plotr
  s   &&,r   r   r   7  se      6
+f+BKK&&&6!!!s+t
+f+s   A+A-)NT)T)NNN)NNNN)linearr  )r   r   rH   )rc   )F))__doc__
__future__r   typingr   numpyr]   pandas.core.dtypes.apir   pandasr  r   pandas._testing_testingr&   collections.abcr   r   r   r   r   r0   r8   rF   rP   rf   r   r|   r   r   r   r   r   r   r   r   r   r   r  r   r   r@   r   r   <module>r     s    #    /   ($+0'./&.((".=&@(,G^-$)X "8:%z,^;  <,)Xr   