
    bMhg                     x    d Z ddlZddlZddlmZmZmZ ddlm	Z	m
Z
  ej        d            G d d          ZdS )z Test cases for GroupBy.plot     N)	DataFrameIndexSeries)_check_axes_shape_check_legend_labels
matplotlibc                       e Zd Zd Zd Zd Zd Zd Zd Zd Z	d Z
d	 Zd
 Zd Zej                            dddg          d             Zej                            dddg          d             Zd Zd ZdS )TestDataFrameGroupByPlotsc                 H   d}t          t          j                            d                              dd|                    }t          j                            d                              ddg|          }|                    |                                           d S )N
            sizemalefemaler   nprandomdefault_rngnormalchoicegroupbyplot)selfnweightgenders       b/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/pandas/tests/plotting/test_groupby.py,test_series_groupby_plotting_nominally_workszFTestDataFrameGroupByPlots.test_series_groupby_plotting_nominally_works   s    	--a0077Ra7HHII&&q))00&(1C!0LLv##%%%%%    c                 H   d}t          t          j                            d                              dd|                    }t          j                            d                              ddg|          }|                    |                                           d S )Nr   r   <   r   r   r   )r   r   r   r   r   r   r   histr   r   heightr   s       r    1test_series_groupby_plotting_nominally_works_histzKTestDataFrameGroupByPlots.test_series_groupby_plotting_nominally_works_hist   s    	--a0077BQ7GGHH&&q))00&(1C!0LLv##%%%%%r"   c                 L   d}t          t          j                            d                              dd|                    }t          j                            d                              ddg|          }|                    |                              d           d S )	Nr   r   r$   r   r   r   g      ?)alphar   r&   s       r    2test_series_groupby_plotting_nominally_works_alphazLTestDataFrameGroupByPlots.test_series_groupby_plotting_nominally_works_alpha"   s    	--a0077BQ7GGHH&&q))00&(1C!0LLv####.....r"   c                     t          g dt          j                            d                              d          dg d          }|                    d          d                                          d S )	N	   r.   r.   r   r   r      r/   r/   r   	   defval	      ?       @      @r5   r6   r7   r5   r6   r7   indexr2   r3   )r   r   r   r   standard_normalr   r   r   dfs     r    $test_plotting_with_float_index_worksz>TestDataFrameGroupByPlots.test_plotting_with_float_index_works)   s    222y,,Q//??BB  @??
 
 
 	

5% %%'''''r"   c                     t          g dt          j                            d                              d          dg d          }|                    d          d                             d	            d S )
Nr-   r   r0   r1   r4   r8   r2   r3   c                 *    |                                  S )N)r   )xs    r    <lambda>zVTestDataFrameGroupByPlots.test_plotting_with_float_index_works_apply.<locals>.<lambda>>   s     r"   )r   r   r   r   r:   r   applyr;   s     r    *test_plotting_with_float_index_works_applyzDTestDataFrameGroupByPlots.test_plotting_with_float_index_works_apply5   s    222y,,Q//??BB  @??
 
 
 	

5% &&'9'9:::::r"   c                     t          j        ddd          }t          ddgddgddgd	          }|d
                             |d         |           d S )NP   f   r.   AAABBBr   U   Y   NameByColMarkrN   rM   bybinsr   aranger   r%   r   rQ   r<   s      r    test_hist_single_rowz.TestDataFrameGroupByPlots.test_hist_single_row@   s\    yWa((!Q"bRRSS
6
2g;T22222r"   c                     t          j        ddd          }t          dgdgdgd          }|d                             |d         |	           d S )
NrE   rF   r.   rG   rI   rK   rN   rM   rO   rR   rT   s      r    !test_hist_single_row_single_bycolz;TestDataFrameGroupByPlots.test_hist_single_row_single_bycolF   sV    yWa((1#tDDEE
6
2g;T22222r"   c                     t          g dg dt          d          d          }|                    d          j                            dd           d S )Nr.   r   r/         r.   r   r/   r   r.   ababar@   yzr`   r@   r_   )r   listr   r   scatterr;   s     r    test_plot_submethod_worksz3TestDataFrameGroupByPlots.test_plot_submethod_worksL   sP    ___???gWWXX


3$$S#.....r"   c                     t          g dg dt          d          d          }|                    d          d         j                                         d S )NrY   r\   r]   r^   r`   r@   )r   ra   r   r   liner;   s     r    test_plot_submethod_works_linez8TestDataFrameGroupByPlots.test_plot_submethod_works_lineP   sQ    ___???gWWXX


3!&&(((((r"   c                     t          g dg dt          d          d          }|                    d                              ddd	          }t	          |d
         j                  dk    sJ d S )NrY   r\   r]   r^   r`   rb   r@   r_   )kindr@   r_   ar.   )r   ra   r   r   lencollectionsr   r<   ress      r    test_plot_kwargsz*TestDataFrameGroupByPlots.test_plot_kwargsT   ss    ___???gWWXXjjoo""	SC"@@ 3s8'((A------r"   c                     t          g dg dt          d          d          }|                    d          j                            dd          }t          |d	         j                  d
k    sJ d S )NrY   r\   r]   r^   r`   r@   r_   )r@   r_   ri   r.   )r   ra   r   r   rb   rj   rk   rl   s      r    test_plot_kwargs_scatterz2TestDataFrameGroupByPlots.test_plot_kwargs_scatter\   sr    ___???gWWXXjjoo"**SC*883s8'((A------r"   zcolumn, expected_axes_num)Nr   )br.   c                    d|f}|pdgdgg}t          ddgz  ddgz  z   d          }t          t          j                            d	                              d
          |ddg          }|                    d          }|                    d|          D ]@}t          |||           t          |d         |          D ]\  }	}
t          |	|
           Ad S )Nr.   ri   rq      12cnamer      r   r9   columnsT)legendcolumnaxes_numlayoutr   )r   r   r   r   r   r:   r   r%   r   zipr   )r   r~   expected_axes_numexpected_layoutexpected_labelsr9   r<   gaxesaxexpected_labels              r    #test_groupby_hist_frame_with_legendz=TestDataFrameGroupByPlots.test_groupby_hist_frame_with_legenda   s    /0 2cUSENbC5j2:-C888I!!!$$44W==#J
 
 

 JJsOOFF$vF66 	9 	9Dd->WWWW&)$q'?&C&C 9 9"N$R88889	9 	9r"   r~   Nrq   c                    t          ddgz  ddgz  z   d          }t          t          j                            d                              d          |dd	g
          }|                    d          }t          j        t          d          5  |
                    d|d           d d d            d S # 1 swxY w Y   d S )Nrs   rt   ru   rv   rw   r   ry   ri   rq   r{    Cannot use both legend and labelmatchTd)r}   r~   labelr   r   r   r   r   r:   r   pytestraises
ValueErrorr%   )r   r~   r9   r<   r   s        r    *test_groupby_hist_frame_with_legend_raiseszDTestDataFrameGroupByPlots.test_groupby_hist_frame_with_legend_raisest   s	    bC5j2:-C888I!!!$$44W==#J
 
 

 JJsOO]:-OPPP 	: 	:FF$vSF999	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	: 	:s   B77B;>B;c                 v   t          ddgz  ddgz  z   d          }t          t          j                            d                              d          |dd	g
          }|                    d          }|d                             d          D ]&}t          |dd           t          |ddg           'd S )Nrs   rt   ru   rv   rw   r   ry   ri   rq   r{   T)r}   r.   )r.   r.   r   )
r   r   r   r   r   r:   r   r%   r   r   )r   r9   r<   r   r   s        r    $test_groupby_hist_series_with_legendz>TestDataFrameGroupByPlots.test_groupby_hist_series_with_legend   s    bC5j2:-C888I!!!$$44W==#J
 
 

 JJsOOC&++T+** 	1 	1Bb1V<<<< c3Z0000	1 	1r"   c                    t          ddgz  ddgz  z   d          }t          t          j                            d                              d          |dd	g
          }|                    d          }t          j        t          d          5  |
                    dd           d d d            d S # 1 swxY w Y   d S )Nrs   rt   ru   rv   rw   r   ry   ri   rq   r{   r   r   Tr   )r}   r   r   )r   r9   r<   r   s       r    +test_groupby_hist_series_with_legend_raiseszETestDataFrameGroupByPlots.test_groupby_hist_series_with_legend_raises   s   bC5j2:-C888I!!!$$44W==#J
 
 

 JJsOO]:-OPPP 	+ 	+FF$cF***	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+ 	+s   B66B:=B:)__name__
__module____qualname__r!   r(   r+   r=   rC   rU   rW   rc   rf   rn   rp   r   markparametrizer   r   r   r    r"   r    r
   r
      s>       & & && & &/ / /
( 
( 
(	; 	; 	;3 3 33 3 3/ / /) ) ). . .. . .
 [89h:OPP9 9 QP9$ [Xc{33: : 43:1 1 1+ + + + +r"   r
   )__doc__numpyr   r   pandasr   r   r   pandas.tests.plotting.commonr   r   importorskipr
   r   r"   r    <module>r      s    # #              
       
  L ! ! !G+ G+ G+ G+ G+ G+ G+ G+ G+ G+r"   