
    Eg:q                         d Z ddlZddlZddlZddlmZ ddlmZ ddl	Z
ddl	mZmZmZ ddlmZ ddlmZmZmZmZmZmZ ddlmZ  ej        d          Z ej        d	          Z G d
 d          ZdS )z Test cases for DataFrame.plot     N)is_platform_linux)np_version_gte1p24)	DataFrameSeries
date_range)_check_axes_shape_check_box_return_type_check_legend_labels_check_ticks_props_check_visible_flatten_visible)pprint_thing
matplotlibzmatplotlib.pyplotc                   X	   e Zd Zej        j        ej                            dg d          d                         Zej        j        ej                            dg d          d                         Zej        j        ej                            dg d          d                         Z	ej                            dddg          d             Z
ej                            dddg          d	             Zej                            d
g d          d             Zd Zej                            d          d             Zej                            dddgddgddgddgddgddgg          d             Zd Zej                            di dddfdd idd d fg          d!             Zej        j        ej                            d" ed#           ed$d#%          g          d&                         Zd' Zd( Zej                            dd)dgddgddgg          d*             Zd+ Zd, Zd- Zd. Zd/ Zd0 Zej                            eo	 e             d1d23          d4             Z!ej                            eo	 e             d1d23          d5             Z"d6 Z#ej                            d7g d8          d9             Z$d: Z%d; Z&d< Z'd= Z(d> Z)ej                            d?d@dAdBdCdDdEddFgfg          ej                            dg dG          dH                         Z*ej                            dIdJdKdLdJdKdMdNdOdKdLdOdKdMdNdJd2dLdJd2dMdNdOd2dLdOd2dMdNdJdKdPdJdKdMdQdOdKdPdOdKdMdQdJdKdRdSdJdKdMdRdTdOdKdRdSdOdKdMdRdTdJd2dRdSdJd2dMdRdTdOd2dRdSdOd2dMdRdTdJdKdRdUdJdKdMdRdVdOdKdRdUdOdKdMdRdVg          dW             Z+ej                            dIdJd2dLdJdKdLdOd2dLdOdKdLdJdKdPdOdKdPg          dX             Z,ej                            dIdJd2dLdJdKdLdOd2dLdOdKdLdJdKdPdOdKdPg          dY             Z-ej                            dZdd[g          d\             Z.ej                            d]dJd^dKigdOd^d2igdOd^dKigdJd_dKigdOd_dKigg          d`             Z/	 	 	 	 	 	 dddcZ0dDS )eTestDataFramePlotsSubplotskind)barbarhlineareac                    t          t          j                            d                              d          t	          t
          j        d d                             }|                    |ddd          }t          |dd	           |j	        d
k    sJ t          ||j                  D ]$\  }}t          |t          |          g           %|d d         D ]}t          |j                   t          |                                d           |dk    r%t          |                    d          d           t          |j                                        d           t          |                                           t          |d         j                   t          |d                                                    t          |d                             d                     t          |d         j                                                   t          |d                                                    d S )N   
      r   indexT)r   subplotssharexlegendr   r      axes_numlayoutr   labelsFvisibler   minor)r   nprandomdefault_rngliststringascii_lettersplotr   shapezipcolumnsr
   r   r   xaxisget_xticklabels	get_labelget_yticklabels)selfr   dfaxesaxcolumns         d/var/www/sysmax/venv/lib/python3.11/site-packages/pandas/tests/plotting/frame/test_frame_subplots.pytest_subplotsz(TestDataFramePlotsSubplots.test_subplots"   s    I!!!$$++G44v+CRC011
 
 

 wwD4TwJJ$6::::zT!!!!dBJ// 	D 	DJB \&-A-A,BCCCCCss) 	1 	1B28$$$2--//????u}}r111==uMMMM28--//????2--//0000tBx~&&&tBx//11222tBx//d/;;<<<tBx~//11222tBx//1122222    c                 >   t          t          j                            d                              d          t	          t
          j        d d                             }|                    |dd          }|D ]}t          |j	                   t          |
                                           t          |
                    d                     t          |j	                                                   t          |                                           d S )	Nr   r   r   r   TFr   r   r   r,   )r   r/   r0   r1   r2   r3   r4   r5   r   r9   r:   r;   r<   r=   r   r>   r?   r@   s        rB   test_subplots_no_share_xz3TestDataFramePlotsSubplots.test_subplots_no_share_x@   s    I!!!$$++G44v+CRC011
 
 
 wwD4w>> 	1 	1B28$$$2--//0002--D-99:::28--//0002--//0000	1 	1rD   c                 ,   t          t          j                            d                              d          t	          t
          j        d d                             }|                    |dd          }|D ]}|                                J d S )Nr   r   r   r   TF)r   r   r    )	r   r/   r0   r1   r2   r3   r4   r5   
get_legendrG   s        rB   test_subplots_no_legendz2TestDataFramePlotsSubplots.test_subplots_no_legendO   s     I!!!$$++G44v+CRC011
 
 
 wwD4w>> 	+ 	+B==??****	+ 	+rD   r   r   c                     t          ddd          }t          t          j                            d                              d          |          }|                    |dd	          }t          |d
d           |d d         D ]}t          |j                   t          |	                                d           t          |	                    d          d           t          |j        
                                d           t          |                                           t          |d         j                   t          |d         	                                           t          |d         	                    d                     t          |d         j        
                                           t          |d                                                    t          |d           d S )N
2014-07-01MEr   startfreqperiodsr   r   r   TrF   r   r!   r#   r)   Fr*   r,   r.   r   )xrot)r   r   r/   r0   r1   r5   r   r   r9   r:   r;   r<   r   r=   r   idxr>   r?   r@   s         rB   test_subplots_timeseriesz3TestDataFramePlotsSubplots.test_subplots_timeseriesZ   s   |$CCCry,,Q//66w??sKKKwwD4w==$6::::ss) 	1 	1B28$$$2--//????2--D-995IIII28--//????2--//0000tBx~&&&tBx//11222tBx//d/;;<<<tBx~//11222tBx//112224a((((((rD   c                 N   t          ddd          }t          t          j                            d                              d          |          }|                    |dd	d
d          }|D ]}t          |j                   t          |                                           t          |                    d                     t          |j        	                                           t          |
                                           t          |dd
d           d S )NrM   rN   r   rO   r   r   r   TF-      )r   r   r   rotfontsizer,   )
xlabelsizerS   
ylabelsize)r   r   r/   r0   r1   r5   r   r9   r:   r;   r<   r   rT   s         rB   test_subplots_timeseries_rotz7TestDataFramePlotsSubplots.test_subplots_timeseries_rotq   s   |$CCCry,,Q//66w??sKKKwwD42PQwRR 	H 	HB28$$$2--//0002--D-99:::28--//0002--//000rabQGGGGG	H 	HrD   col)numeric	timedeltadatetime_no_tzdatetime_all_tzc           	         t          j        g d          t          j        dd          t          j        dd          t          j        dd          gt          j        d          t          j        d	          t          j        d
          gt          j        dd          t          j        d	d          t          j        d
d          gg dd}t          |          }|                    |          }|                                d                                         d         }||         j	        }||k    
                                sJ d S )Nr"   r      is)unitr   mh2017-08-01 00:00:002017-08-01 02:00:002017-08-02 00:00:00TutcThisshouldfail)r`   ra   rb   rc   textyr   r"   )r/   arraypd	Timedeltato_datetimer   r5   	get_linesget_datavaluesall)r=   r_   datatestdatar@   resultexpecteds          rB   test_subplots_timeseries_y_axisz:TestDataFramePlotsSubplots.test_subplots_timeseries_y_axis~   sJ    x			**Ss+++Rc***Rc*** 455455455 4$???4$???4$??? 
 /..#
 
& T??]]S]!!"++--a0C='("'')))))))rD   c                     t          j        g d          g dd}t          |          }d}t          j        t
          |          5  |                    d           d d d            d S # 1 swxY w Y   d S )Nre   rp   )r`   rt   zno numeric data to plotmatchrt   ru   )r/   rw   r   pytestraises	TypeErrorr5   )r=   r   r   msgs       rB   %test_subplots_timeseries_y_text_errorz@TestDataFramePlotsSubplots.test_subplots_timeseries_y_text_error   s     x			**...
 
 T??']9C000 	$ 	$MMFM###	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$ 	$s   A,,A03A0z6not support for period, categorical, datetime_mixed_tz)reasonc                    t          j        g d          t          j        dd          t          j        dd          t          j        dd          gt          j        g dg dd	
          t          j        dd          t          j        d          t          j        d          gd}t          |          }|                    dd          }|                                d         	                                d         |d         j
        k                                    sJ |                    dd          }|                                d         	                                d         |d         j
        k                                    sJ |                    dd          }|                                d         	                                d         |d         j
        k                                    sJ dS )a  
        This test will fail for:
            period:
                since period isn't yet implemented in ``select_dtypes``
                and because it will need a custom value converter +
                tick formatter (as was done for x-axis plots)

            categorical:
                 because it will need a custom value converter +
                 tick formatter (also doesn't work for x-axis, as of now)

            datetime_mixed_tz:
                because of the way how pandas handles ``Series`` of
                ``datetime`` objects with different timezone,
                generally converting ``datetime`` objects in a tz-aware
                form could help with this problem
        re   rk   H)rQ   z2017-08-01 02:00rm   )cba)r   r   r   F)
categoriesorderedTrn   rl   )r`   periodcategoricaldatetime_mixed_tzr`   r   )xrv   r   r"   r   r   N)r/   rw   rx   PeriodCategoricalrz   r   r5   r{   r|   r}   r~   )r=   r   r   	ax_periodax_categoricalax_datetime_mixed_tzs         rB   -test_subplots_timeseries_y_axis_not_supportedzHTestDataFramePlotsSubplots.test_subplots_timeseries_y_axis_not_supported   s   ( x			**	/c:::	,3777	/c:::
 >OOOU   4$???455455"
 
  T??MMIM::	!!!$--//2hx6H6OO
#%%	 	 	 "mDD$$&&q)2244Q7&-.
#%%	 	 	  (}}y<O}PP **,,Q/88::1=+,34
#%%	 	 	 	 	rD   zlayout, exp_layout)r   r   )r.   r   )r   r.   )r"      )r.   r   )r   r.   )r   r"   c                 2   t          t          j                            d                              d          t	          t
          j        d d                             }|                    d|          }t          |d|           |j	        |k    sJ d S )	Nr   r   r   r   Tr   r%   r   r#   
r   r/   r0   r1   r2   r3   r4   r5   r   r6   )r=   r%   
exp_layoutr>   r?   s        rB   !test_subplots_layout_multi_columnz<TestDataFramePlotsSubplots.test_subplots_layout_multi_column   s     I!!!$$++G44v+CRC011
 
 

 wwVw44$:>>>>zZ''''''rD   c                    t          t          j                            d                              d          t	          t
          j        d d                             }d}t          j        t          |          5  |
                    dd	           d d d            n# 1 swxY w Y   d
}t          j        t          |          5  |
                    dd	           d d d            d S # 1 swxY w Y   d S )Nr   r   r   r   z1Layout of 1x1 must be larger than required size 3r   Tr"   r"   r   z1At least one dimension of layout must be positive)r.   r.   )r   r/   r0   r1   r2   r3   r4   r   r   
ValueErrorr5   )r=   r>   r   s      rB   'test_subplots_layout_multi_column_errorzBTestDataFramePlotsSubplots.test_subplots_layout_multi_column_error   sm   I!!!$$++G44v+CRC011
 
 
 B]:S111 	2 	2GGT&G111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 B]:S111 	4 	4GGT(G333	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4 	4s$   >B""B&)B&
C//C36C3z:kwargs, expected_axes_num, expected_layout, expected_shaper"   r   r"   r%   )r   r   c                 "   t          t          j                            d                              d          t	          t
          j        d d                             } |j        dddi|}t          |||           |j	        |k    sJ d S )	Nr   r   r"   r   r   r   Tr#    r   )r=   kwargsexpected_axes_numexpected_layoutexpected_shaper>   r?   s          rB   "test_subplots_layout_single_columnz=TestDataFramePlotsSubplots.test_subplots_layout_single_column   s     I!!!$$++G44v+CRC011
 
 
 rw/////&"	
 	
 	
 	

 z^++++++rD   rU   rf   1/1/2000rR   c                    t          j        d           5  t          t          j                            d                              d          |          }|                    dd           d d d            d S # 1 swxY w Y   d S )Nr   )rf   r   r   T)r   r   r   )tmassert_produces_warningr   r/   r0   r1   standard_normalr5   )r=   rU   r>   s      rB   test_subplots_warningsz1TestDataFramePlotsSubplots.test_subplots_warnings  s     '-- 	2 	2290033CCFKKSVWWWBGGT&G111	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2 	2s   AA;;A?A?c                 l   t           j                            dd          \  }}t          t          j                            d                              d          t          t          j	        d d                             }|
                    d|d         dd	          }t          |dd
           |j        dk    sJ |d         j        |u sJ |
                    d|d         dd	          }t          |dd
           |j        dk    sJ |d         j        |u sJ t          |dd           d S )Nr   r   r   r   r   Tr   Fr   r@   r   sharey)r"   r   r#   r&   r"      )r   r   )mplpyplotr   r   r/   r0   r1   r2   r3   r4   r5   r   r6   figure)r=   figr?   r>   returneds        rB   test_subplots_multiple_axesz6TestDataFramePlotsSubplots.test_subplots_multiple_axes  s@   J''1--	TI!!!$$++G44v+CRC011
 
 

 77DT!WU57QQ(Qv>>>>~%%%%{!S((((77DT!WU57QQ(Qv>>>>~%%%%{!S(((($6::::::rD   c                    t          t          j                            d                              d          t	          t
          j        d d                             }d}t          j        	                    dd          \  }}t          j        t          |          5  |                    d|	           d d d            d S # 1 swxY w Y   d S )
Nr   r   r   r   z@The number of passed axes must be 3, the same as the output plotr   r   Tr   r@   )r   r/   r0   r1   r2   r3   r4   r   r   r   r   r   r   r5   )r=   r>   r   _r?   s        rB   !test_subplots_multiple_axes_errorz<TestDataFramePlotsSubplots.test_subplots_multiple_axes_error2  s    I!!!$$++G44v+CRC011
 
 
 Q*%%a++4]:S111 	, 	,GGTdG+++	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	,s   !CC
C
)r   r"   c                    t           j                            dd          \  }}t          t          j                            d                              d          t          t          j	        d d                             }t          j        t                    5  |                    d||dd          }t          |d|	           |j        d
k    sJ 	 d d d            d S # 1 swxY w Y   d S )Nr   )r   r   r   r   TF)r   r@   r%   r   r   r   r#   )r   )r   r   r   r   r/   r0   r1   r2   r3   r4   r   r   UserWarningr5   r   r6   )r=   r%   r   r   r?   r>   r   s          rB   !test_subplots_multiple_axes_2_dimz<TestDataFramePlotsSubplots.test_subplots_multiple_axes_2_dim?  s2    *%%a++4I!!!$$++G44v+CRC011
 
 
 '44 	* 	*ww$veE   H h:FFFF>T)))))	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	* 	*s   :C%%C),C)c                 ~   t           j                            dd          \  }}t          t          j                            d                              d          t          t          j	        d d                             }|
                    d|gdd          }t          |dd	
           |j        dk    sJ d S )Nr"   r   r   r   r   TFr   r   r#   r   )r   r   r   r   r/   r0   r1   r2   r3   r4   r5   r   r6   )r=   r   r?   r>   s       rB   &test_subplots_multiple_axes_single_colzATestDataFramePlotsSubplots.test_subplots_multiple_axes_single_colY  s     *%%a++4I!!!$$++G44v+CRC011
 
 

 ww$ewLL$6::::zT!!!!!!rD   c                 d   t           j                            dddd          \  }}t           j                            dddd           t	          t
          j                            d                              d	          t          d
dd                    }t          |                                          D ]"\  }}||                             |d           #|dd                                         D ]%}t          |                                d           &|d                                         D ]%}t          |                                d           &|g ddgf                                         D ]%}t          |                                d           &|g ddgf                                         D ]%}t          |                                d           &|g ddgf                                         D ]%}t          |                                d           &d S )Nr   T)r   r   g?gffffff?g333333?)leftrighthspacewspacer   )r   	   rM   rN   r   rO   r   rf   )r@   r[   r   r.   Fr*   )r   r"   r   r"   )r   r   r   subplots_adjustr   r/   r0   r1   r   r   	enumerateravelr5   r   r:   r<   )r=   r   r?   r>   ir@   s         rB   test_subplots_ts_share_axesz6TestDataFramePlotsSubplots.test_subplots_ts_share_axesf  sN   *%%a4%EE4
""DS"QQQI!!!$$44W==<dBGGG
 
 
 tzz||,, 	* 	*EArqEJJ"qJ)))) qt*""$$ 	@ 	@B2--//????? r(.."" 	? 	?B2--//>>>>> yyy1#~&,,.. 	? 	?B2--//>>>>> yyy1#~&,,.. 	@ 	@B2--//?????yyy1#~&,,.. 	@ 	@B2--//?????	@ 	@rD   c                    g dg dg dd}t          |t          dd                    }|dd	g                             d
          }|d                             |d         d
           t          |d                                         d           t          |d                                         d
           |                                D ]%}t          |                                d
           &d S )N)      ?       @      @      @)r   r   r   r   )rf   r"   r   r   )ABCz
2014 10 11z
2014 10 14r   r   r   Tr   r   r   )r@   secondary_yFr*   r"   )r   r   r5   r   r:   r   r<   )r=   dr>   r?   r@   s        rB   'test_subplots_sharex_axes_existing_axeszBTestDataFramePlotsSubplots.test_subplots_sharex_axes_existing_axes  s   &&&-A-A-AUUq
< F FGGG3*~""D"11
3QT222tAw..00%@@@@tAw..00$????**,, 	? 	?B2--//>>>>>	? 	?rD   c                 0   t          t          j                            d                              d          t	          d                    }|                    d          }|D ].}t          |dg           t          |j                  d	k    sJ /d S )
Nr   rf   rf   aaaaar8   Tr   r   r'   r"   	r   r/   r0   r1   r2   r5   r
   lenlinesr=   r>   r?   r@   s       rB   test_subplots_dup_columnsz4TestDataFramePlotsSubplots.test_subplots_dup_columns  s    ry,,Q//66v>>WVVVwww%% 	& 	&B SE2222rx==A%%%%%	& 	&rD   c                 2   t          t          j                            d                              d          t	          d                    }|                    dd          }|D ].}t          |dg           t          |j                  d	k    sJ /d S )
Nr   r   r   r   Tr   )r   r   r'   r"   r   r   s       rB   %test_subplots_dup_columns_secondary_yz@TestDataFramePlotsSubplots.test_subplots_dup_columns_secondary_y  s    ry,,Q//66v>>WVVVww#w66 	& 	&B SE2222rx==A%%%%%	& 	&rD   c                 j   t          t          j                            d                              d          t	          d                    }|                    d          }t          |dgdz  	           t          |j                  d
k    sJ t          |j	        j                  dk    sJ d S )Nr   r   r   r   r   )r   z	a (right)rf   r'   r   )
r   r/   r0   r1   r2   r5   r
   r   r   right_ax)r=   r>   r@   s      rB   0test_subplots_dup_columns_secondary_y_no_subplotzKTestDataFramePlotsSubplots.test_subplots_dup_columns_secondary_y_no_subplot  s    ry,,Q//66v>>WVVVWWW%%R(9::::28}}!!!!2;$%%******rD   zWeird rounding problemsF)r   strictc           	      B   t          j        g d          }t          dgdz  t          t	          dd                    dt	          d                    }|j                            dd	          }t          j        |j	        
                                |           d S )
N)皙?r         $@d   r   rf   r"   r   r   r   r   T)gridlog)r/   rw   r   r2   ranger5   r   r   assert_numpy_array_equalyaxisget_ticklocs)r=   r   r>   r@   s       rB   test_bar_log_no_subplotsz3TestDataFramePlotsSubplots.test_bar_log_no_subplots  s     811122 aS1W4a+<+<==U1XXNNNW[[d[--
#BH$9$9$;$;XFFFFFrD   c                    t          j        g d          }t          t          ddg          t          ddg          g          j                            dd          }t          j        |d         j        	                                |           t          j        |d         j        	                                |           d S )	N)r   r   r   g      Y@g     @@g     @   i,  i  T)r   r   r   r"   )
r/   rw   r   r   r5   r   r   r   r   r   )r=   r   r@   s      rB   test_bar_log_subplotsz0TestDataFramePlotsSubplots.test_bar_log_subplots  s     8@@@AASz**FC:,>,>?@@EIIt J 
 
 	#BqEK$<$<$>$>III
#BqEK$<$<$>$>IIIIIrD   c                     |}|j                             d          }t          |t                    sJ t	          |d g d           d S )NTr   heightweightcategory)expected_keys)r5   box
isinstancer   r	   )r=   hist_dfr>   r   s       rB   )test_boxplot_subplots_return_type_defaultzDTestDataFramePlotsSubplots.test_boxplot_subplots_return_type_default  sc     d++&&)))))D(H(H(H	
 	
 	
 	
 	
 	
rD   rt)dictr?   bothc                 l    |}|j                             |d          }t          ||g dd           d S )NT)return_typer   r  F)r  check_ax_title)r5   r  r	   )r=   r  r
  r>   r   s        rB   !test_boxplot_subplots_return_typez<TestDataFramePlotsSubplots.test_boxplot_subplots_return_type  sQ    7;;2;==::: 		
 	
 	
 	
 	
 	
rD   c                    t          t          j                            d                              d          t          dd          t          d                    }t                              ddd	
          \  }}|	                    d	|          }|D ]?}t          |j                  dk    sJ t          |                                d	           @t          |d                                         d           t          |d                             d	          d           t          |d                                         d	           t          |d                             d	          d	           d S )Nr   r   r   r   r   r   ABr   r8   r"   T)r   r   r*   r   Fr,   r   r/   r0   r1   r   r   r2   pltr   r5   r   r   r   r<   r:   r=   r>   r   r?   r@   s        rB   $test_df_subplots_patterns_minorticksz?TestDataFramePlotsSubplots.test_df_subplots_patterns_minorticks  sh   I!!!$$44W==Z444JJ
 
 
 ,,q!D,114www.. 	? 	?Brx==A%%%%2--//>>>>>tAw..00%@@@@tAw..T.::EJJJJtAw..00$????tAw..T.::DIIIIIIrD   c                 d   t          t          j                            d                              d          t          dd          t          d                    }t                              dd          \  }}t          j
        t                    5  |                    d	|d	
          }d d d            n# 1 swxY w Y   |D ]?}t          |j                  dk    sJ t          |                                d	           @t          |d                                         d           t          |d                             d	          d           t          |d                                         d	           t          |d                             d	          d	           d S )Nr   r  r   r   r   r  r  r"   T)r   r@   r   r*   r   Fr,   )r   r/   r0   r1   r   r   r2   r  r   r   r   r   r5   r   r   r   r<   r:   r  s        rB   2test_df_subplots_patterns_minorticks_1st_ax_hiddenzMTestDataFramePlotsSubplots.test_df_subplots_patterns_minorticks_1st_ax_hidden  s   I!!!$$44W==Z444JJ
 
 

 ,,q!$$4'44 	@ 	@77DT$7??D	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	@ 	? 	?Brx==A%%%%2--//>>>>>tAw..00%@@@@tAw..T.::EJJJJtAw..00$????tAw..T.::DIIIIIIs   B;;B?B?c                 @   t          t          j                            d                              d          t          dd          t          d                    }t                              dd          \  }}|	                    d	|
          }|D ]}t          |j                  dk    sJ t          |                                d	           t          |                                d	           t          |                    d	          d	           d S )Nr   r  r   r   r   r  r  r"   Tr   r*   r,   r  r  s        rB   /test_df_subplots_patterns_minorticks_not_sharedzJTestDataFramePlotsSubplots.test_df_subplots_patterns_minorticks_not_shared  s   I!!!$$44W==Z444JJ
 
 
 ,,q!$$4www.. 	I 	IBrx==A%%%%2--//>>>>2--//>>>>2--D-994HHHHH		I 	IrD   c                 p   t          t          j                            d                              d                    }t          j        |j        dd df<   t          j        |j        d ddf<   t          j                            dd          \  }}|j	        
                    |dd           t          j        d	d
d          }t          j        ddd          }t          j        |d                                         |           t          j        |d                                         |           d S )Nr   r  rf   r"   r   TF)r@   r   r   g      @r         ?      )r   r/   r0   r1   nanilocr   r   r   r5   r   aranger   r   
get_xticks)r=   r>   r   axsexpected_ax1expected_ax2s         rB   test_subplots_sharex_falsez5TestDataFramePlotsSubplots.test_subplots_sharex_false  s     ry,,Q//66w??@@AA$$Q**3
d5999yb#..yq#..
#CF$5$5$7$7FFF
#CF$5$5$7$7FFFFFrD   c                 R   t          dd          }t          t          j                            d                              d          |          }i }t          t          j        j        d          rd|d	<   t          j        j	        di |\  }}t          j        d           5  |                    |d
                    t          j        d          5 }t          j                            |           d d d            n# 1 swxY w Y   d d d            d S # 1 swxY w Y   d S )Nnowr   )rP   rR   r   r   r   get_constrained_layoutTconstrained_layoutr   )r@   )return_filelike)r   )r   r   r/   r0   r1   hasattrr   r   Figurer   r   r   r5   ensure_cleansavefig)r=   rU   r>   r   r   r?   paths          rB    test_subplots_constrained_layoutz;TestDataFramePlotsSubplots.test_subplots_constrained_layout#  s   ub111ry,,Q//66w??sKKK3:$&>?? 	0+/F'(*%226224'-- 	) 	)GGtAwG666 )$
""4((() ) ) ) ) ) ) ) ) ) ) ) ) ) )	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	) 	)s6   &2D D8DD	DD	DD #D z index_name, old_label, new_label)N new)oldr5  r4  )Nr3  r3  )Nr3  r"   Nr3  r   )r   r   r   c                    t          ddgddggddg          }||j        _        |                    |d          }t	          d	 |D                       sJ t	          fd
|D                       sJ |                    |d          }t	          fd|D                       sJ t	          fd|D                       sJ d S )Nr"   r   rf   zType AzType Br   Tr   r   c              3   F   K   | ]}|                                 d k    V  dS )r3  N)
get_ylabel).0r@   s     rB   	<genexpr>zSTestDataFramePlotsSubplots.test_xlabel_ylabel_dataframe_subplots.<locals>.<genexpr>D  s/      88R2==??b(888888rD   c              3   H   K   | ]}|                                 k    V  d S N)
get_xlabel)r:  r@   	old_labels     rB   r;  zSTestDataFramePlotsSubplots.test_xlabel_ylabel_dataframe_subplots.<locals>.<genexpr>E  s0      ??B2==??i/??????rD   )r   ylabelxlabelr   c              3   b   K   | ])}|                                 t                    k    V  *d S r=  )r9  strr:  r@   	new_labels     rB   r;  zSTestDataFramePlotsSubplots.test_xlabel_ylabel_dataframe_subplots.<locals>.<genexpr>I  6      DD2==??c)nn4DDDDDDrD   c              3   b   K   | ])}|                                 t                    k    V  *d S r=  )r>  rC  rD  s     rB   r;  zSTestDataFramePlotsSubplots.test_xlabel_ylabel_dataframe_subplots.<locals>.<genexpr>J  rF  rD   )r   r   namer5   r~   )r=   r   
index_namer?  rE  r>   r?   s      ``  rB   %test_xlabel_ylabel_dataframe_subplotsz@TestDataFramePlotsSubplots.test_xlabel_ylabel_dataframe_subplots0  s	    AA'(H1EFFF" wwD4w0088488888888????$???????? wwD9twTTDDDDtDDDDDDDDDDDDtDDDDDDDDDDrD   r   r   T)r   stacked?)r   rK  widthr   r7  )r   r   rM  edge)r   rK  align)r   rK  rM  rO  )r   r   rO  )r   r   rM  rO  c                     t          dgdz  t          t          d                    dt          d                    } | j        |fi | d S )Nr   rf   r   r   )r   r2   r   _check_bar_alignmentr=   r   r>   s      rB   test_bar_align_multiple_columnsz:TestDataFramePlotsSubplots.test_bar_align_multiple_columnsL  sX    F aS1W4a>>::%((KKK!!"///////rD   c                     t          t          j                            d                              d                    } | j        |fi | d S )Nr   rf   r   r/   r0   r1   r   rQ  rR  s      rB   test_bar_align_single_columnz7TestDataFramePlotsSubplots.test_bar_align_single_columnr  sP     ry,,Q//??BBCC!!"///////rD   c                     t          t          j                            d                              d                    } | j        |fddd| d S )Nr   r   rL  g?)rM  positionrU  rR  s      rB   test_bar_barwidth_positionz5TestDataFramePlotsSubplots.test_bar_barwidth_position  sW     ry,,Q//??GGHH!!"HC#HHHHHHHrD   wr   c                    t          t          j                            d                              d                    }|j                            d|          }|j                                        }t          j
        |t          j        g d                     |                                dk    sJ |j        d                                         dk    sJ |j        d	                                         d
k    sJ d S )Nr   r   T)rK  rM  )r   r"   r   r   r   )g      g      @r   r  r.   g      @)r   r/   r0   r1   r   r5   r   r9   r   r   r   rw   get_xlimpatchesget_x)r=   rZ  r>   r@   tickss        rB   test_bar_barwidth_position_intz9TestDataFramePlotsSubplots.test_bar_barwidth_position_int  s     ry,,Q//??GGHHW[[Q[//%%''
#E28OOO+D+DEEE{{}}----z!}""$$,,,,z"~##%%,,,,,,rD   zkind, kwargsrK  r   c                     t          t          j                            d                              d                    } | j        |f|dd| d S )Nr   r   r"   )r   rM  rU  )r=   r   r   r>   s       rB   &test_bar_barwidth_position_int_width_1zATestDataFramePlotsSubplots.test_bar_barwidth_position_int_width_1  sW     ry,,Q//??GGHH!!"C4qCCFCCCCCrD   centerr  c           	         |                     ||||||d          }t          |          }|D ]}	|dk    r[|	j        }
|	                                \  }}t	          d |	j        D                       }t          d |	j        D                       }nh|dk    r[|	j        }
|	                                \  }}t	          d |	j        D                       }t          d |	j        D                       }nt          t          j        ||d	z
             t          j        ||d	z              |	j        d
         }|dk    r8|du s|du r0|                                }||                                |z  z   }n|dk    rZ|du rV|                                |                                t          |j                  z  |z  z   }|                                }n|dk    rI|du s|du rA|                                |                                |z  z   }|                                }ng|dk    rZ|du rV|                                |                                t          |j                  z  |z  z   }|                                }nt          |
                                t'          j        t          |                    k                                    sJ |dk    r/t          j        |
                                d
         |           |dk    r/t          j        |
                                d
         |           t          |S )NT)r   rK  r   rO  rM  rX  r   r   c              3   >   K   | ]}|                                 V  d S r=  )r^  r:  ps     rB   r;  zBTestDataFramePlotsSubplots._check_bar_alignment.<locals>.<genexpr>  *      ==Qqwwyy======rD   c              3   h   K   | ]-}|                                 |                                z   V  .d S r=  )r^  	get_widthrf  s     rB   r;  zBTestDataFramePlotsSubplots._check_bar_alignment.<locals>.<genexpr>  s7      MMQqwwyy1;;==8MMMMMMrD   r   c              3   >   K   | ]}|                                 V  d S r=  )get_yrf  s     rB   r;  zBTestDataFramePlotsSubplots._check_bar_alignment.<locals>.<genexpr>  rh  rD   c              3   h   K   | ]-}|                                 |                                z   V  .d S r=  )rl  
get_heightrf  s     rB   r;  zBTestDataFramePlotsSubplots._check_bar_alignment.<locals>.<genexpr>  s7      NNaqwwyy1<<>>9NNNNNNrD   g      ?r   Frc  rN  )r5   r   r9   r\  minr]  maxr   get_ylimr   r   assert_almost_equalr^  rj  r   r8   rl  rn  r   r/   r"  r~   )r=   r>   r   rK  r   rO  rM  rX  r?   r@   axisax_minax_maxmin_edgemax_edgerg  rN  rc  s                     rB   rQ  z/TestDataFramePlotsSubplots._check_bar_alignment  s"    ww  
 
  %% -	! -	!Bu}}x!#=="*=====MM"*MMMMMx!#=="*=====NN2:NNNNN   "68d?;;;"68d?;;;
1Au}}'T//X5E5Ewwyy 887e#3#3Q[[]]S__%Dx%OOwwyyW__D8H8HQ\\^^h%>>wwyyGu$4$4Q\\^^c"*oo%E%PPwwyy   %%''29SWW+=+==BBDDDDD  &t'8'8':':1'=vFFFF&&t'8'8':':1'=tDDDD  rD   )r   FFrc  r  r  )1__name__
__module____qualname__r   markslowparametrizerC   rH   rK   rV   r^   r   r   xfailr   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r	  r  r  r  r  r'  r2  rJ  rS  rV  rY  r`  rb  rQ  r   rD   rB   r   r   !   s       [[V%D%D%DEE3 3 FE 38 [[V%D%D%DEE1 1 FE 1 [[V%D%D%DEE+ + FE + [Vff%566) ) 76), [Vff%566
H 
H 76
H [LLL * * *8	$ 	$ 	$ [VWW0 0 XW0d [VffVff	

 
	( 	(
 
	(4 4 4 [DFD!FF3	
 , , ,  [[UUU1XXzz*a/P/P/P$QRR2 2 SR 2; ; ;&, , , [Vff	
 * * *$" " "@ @ @:? ? ?& & && & &+ + + [20022(   
G G 
G [20022(   
J J 
J
 
 
 [T#;#;#;<<
 
 =<
J J J(J J J&I I I G G G ) ) ) [*!21v	
	 	 [V%<%<%<==E E >=	 	E" [ t,,tc::--s;;u--us;;..<<--s;;..<<tf==tcFKKv>>sVLLuv>>usVLL??fMMv>>sVLL??fMM9	
   B0 0C   B0
 [u--t,,..----..	

 
0 0
 
0 [u--t,,..----..	

 
I I
 
I [S1c(++	- 	- ,+	- [Y%&i'(i&'Z&'j$'(	
	 	D D	 	D E E E E E ErD   r   )__doc__r3   numpyr/   r   pandas.compatr   pandas.compat.numpyr   pandasrx   r   r   r   pandas._testing_testingr   pandas.tests.plotting.commonr   r	   r
   r   r   r   pandas.io.formats.printingr   importorskipr   r  r   r   rD   rB   <module>r     sd   % %       + + + + + + 2 2 2 2 2 2             
                      4 3 3 3 3 3f,''f-..O O O O O O O O O OrD   