3
$ßL]iN  ã               @   sÞ  d dl Z d dlZd dlmZ d dlZd dlZd dlmZ d dl	j
Zd dlZd dljZd dlj Zd dlmZ d dljZd dlmZ d dlmZ dd„ Zed	gd
d�dd„ ƒZedgd
d�dd„ ƒZedgd�dd„ ƒZedgd
d�dd„ ƒZedgdgd
d�dd„ ƒZ edgdgd
d�dd„ ƒZ!ed gd!d"ij"ej#ƒ d#ƒdgd
d$�d%d&„ ƒZ$ed'gd!d"ij"ej#ƒ d#ƒdgd
d$�d(d)„ ƒZ%ed*gd
d�d+d,„ ƒZ&ed-gd
d!d"ij"ej#ƒ d#ƒd.�d/d0„ ƒZ'ed1d2gd
d�d3d4„ ƒZ(ed5gd
d�d6d7„ ƒZ)ed8gd
d9d:�d;d<„ ƒZ*d=d>„ Z+G d?d@„ d@e,ƒZ-G dAdB„ dBe,ƒZ.edCgdgdD�dEdF„ ƒZ/dGdH„ Z0dIdJ„ Z1dKdL„ Z2edMgdgdD�dNdO„ ƒZ3edPgdgdD�dQdR„ ƒZ4dSdT„ Z5dUdV„ Z6dWdX„ Z7dYdZ„ Z8d[d\„ Z9d]d^„ Z:d_d`„ Z;dadb„ Z<dcdd„ Z=dedf„ Z>dgdh„ Z?dS )ié    N)Úmock)Úimage_comparison)ÚHandlerTuple)ÚMatplotlibDeprecationWarning)Ú
rc_contextc              C   s¸   t jjdƒ} t jjdƒ}dgd dgd  }dgd dgd  }tjƒ \}}x0t| |||ƒD ]\}}}}	|j||||	d� q\W |jƒ \}
}tj	t||
ƒƒ}|j
|jƒ |jƒ ddd� d S )Né
   Úaé   ÚbÚrÚg)ÚlabelÚczcenter lefté   ç      à?)ÚlocÚbbox_to_anchor)r   r   )ÚnpÚrandomZrandnÚpltÚsubplotsÚzipÚscatterZget_legend_handles_labelsÚcollectionsÚOrderedDictÚlegendÚvaluesÚkeys)ÚXÚYÚlabelsÚcolorsÚfigÚaxÚxÚyr   ÚcolorÚhandlesr   © r(   úD/tmp/pip-install-edjban26/matplotlib/matplotlib/tests/test_legend.pyÚtest_legend_ordereddict   s    r*   Zlegend_auto1T)Úbaseline_imagesÚremove_textc              C   sX   t jƒ } | jdƒ}tjdƒ}|j|d| ddd� |j||d ddd� |jdd	� d
S )zTest automatic legend placementéo   éd   é2   Úozy=1)r   zy=-1Úbest)r   N)r   ÚfigureÚadd_subplotr   ÚarangeÚplotr   )r"   r#   r$   r(   r(   r)   Útest_legend_auto1%   s    

r6   Zlegend_auto2c              C   sn   t jƒ } | jdƒ}tjdƒ}|j||ddd�}|j||ddd… ddd�}|j|d	 |d	 gd
dgdd� dS )zTest automatic legend placementr-   r.   ZedgeÚm)Zalignr&   Nr   r   r   ZupZdownr1   )r   éÿÿÿÿ)r   r2   r3   r   r4   Úbarr   )r"   r#   r$   Zb1Zb2r(   r(   r)   Útest_legend_auto20   s    

r:   Zlegend_auto3)r+   c              C   sl   t jƒ } | jdƒ}ddddddg}ddddddg}|j||ddd	� |jd
dƒ |jd
dƒ |jdd� dS )zTest automatic legend placementr-   gÍÌÌÌÌÌì?gš™™™™™¹?g      à?gffffffî?gš™™™™™©?zo-Úline)r   g        g      ð?r1   )r   N)r   r2   r3   r5   Úset_xlimÚset_ylimr   )r"   r#   r$   r%   r(   r(   r)   Útest_legend_auto3;   s    
r>   Zlegend_various_labelsc              C   sl   t jƒ } | jdƒ}|jtjdƒddd� |jtjddƒddd� |jtjdddƒddd� |jdd	d
� d S )Néy   é   r0   r   )r   gffffff@u   DÃ©veloppÃ©sZ__nolegend__r1   )Ú	numpointsr   r8   )r   r2   r3   r5   r   r4   Úlinspacer   )r"   r#   r(   r(   r)   Útest_various_labelsH   s    
rC   Zlegend_labels_firstZpng)r+   Ú
extensionsr,   c              C   sn   t jƒ } | jdƒ}|jtjdƒddd� |jtjdƒd ddd� |jtjd	ddƒd
dd� |jddd� d S )Nr-   r   z-or   )r   r	   z:xr$   é   ÚdZdiamondr1   F)r   Zmarkerfirstr8   )r   r2   r3   r5   r   r4   Zonesr   )r"   r#   r(   r(   r)   Útest_labels_firstS   s    
rG   Zlegend_multiple_keysc              C   s–   t jƒ } | jdƒ}|jdddgdƒ\}|jdddgdƒ\}|jdddgd	ƒ\}|j||f||f|gd
ddgd||ftd d�||ftd dd�id� d S )Nr-   r   é   é   z-or@   z-xr	   z-dztwo keyszpad=0zone key)Úndivider   )rJ   Úpad)rA   Úhandler_map)r   r2   r3   r5   r   r   )r"   r#   Úp1Úp2Zp3r(   r(   r)   Útest_multiple_keys_   s    
rO   Z
rgba_alphaZaarch64g{®Gáz”?g        )r+   ÚtolrD   r,   c              C   sT   dd l j} | jddƒ\}}|jtdƒdd� | jdgdd�}|jjdddd	gƒ d S )
Nr   r   r   r	   )ÚlwzLonglabel that will go awayÚcenter)r   g      à?)Úmatplotlib.pyplotÚpyplotr   r5   Úranger   ÚlegendPatchÚset_facecolor)r   r"   r#   Úlegr(   r(   r)   Útest_alpha_rgban   s
    
rY   Zrcparam_alphac              C   sp   dd l j} | jddƒ\}}|jtdƒdd� tjddid��* | jd	gd
d�}|jj	ddddgƒ W d Q R X d S )Nr   r   r   r	   )rQ   zlegend.framealphag      è?)ÚrczLonglabel that will go awayrR   )r   g      à?)
rS   rT   r   r5   rU   Úmplr   r   rV   rW   )r   r"   r#   rX   r(   r(   r)   Útest_alpha_rcparamz   s    
r\   Zfancyc               C   s~   t jdƒ t jtjdƒtjdddƒdd� t jdgd dd	d� t jtjdƒtjdƒd
d
d	d� t jddd
gddddd� d S )Nr?   r   r   r   zXX
XX)r   r	   zo--ZXXg      à?)ZxerrZyerrr   zcenter leftg      ð?rH   Tz	My legend)r   r   ÚncolÚshadowÚtitlerA   r8   )r   Úsubplotr   r   r4   r5   Zerrorbarr   r(   r(   r(   r)   Ú
test_fancy‹   s    
 
ra   Ú
framealpha)r+   r,   rP   c              C   s4   t jdddƒ} | }tj| |ddd� tjdd� d S )Nr   r.   Zmylabelr   )r   rQ   g      à?)rb   )r   rB   r   r5   r   )r$   r%   r(   r(   r)   Útest_framealpha—   s    rc   Zscatter_rc3Zscatter_rc1c              C   sš   t jƒ  t jdƒ} | jtjdƒtjdddƒdd� | jddd	gd
d� dtjd< t jƒ  t jdƒ} | jtjdƒtjdddƒdd� | jddd	gd
d� d S )Nr?   r   r   r   Zthree)r   zcenter leftg      ð?g      à?z	My legend)r   r   r_   zlegend.scatterpointsZoner8   r8   )	r   r2   r`   r   r   r4   r   r[   ZrcParams)r#   r(   r(   r)   Útest_rc    s    
 

 rd   Zlegend_expandc              C   s®   ddg} t jt| ƒdƒ\}}tjdƒ}x‚t|| ƒD ]t\}}|j|d| ddd� |jd	|d
�}|j|ƒ |j||d ddd� |jd|d
�}|j|ƒ |jd|dd� q2W dS )zTest expand modeNÚexpandr   r.   r/   r0   zy=1)r   z
upper left)r   Úmodezy=-1Úrightz
lower leftrH   )r   rf   r]   )	r   r   Úlenr   r4   r   r5   r   Z
add_artist)Zlegend_modesr"   Z	axes_listr$   r#   rf   Úl1Úl2r(   r(   r)   Útest_legend_expand²   s    


rk   ZhatchingÚdefault)r+   r,   Ústylec           	   C   s  t jƒ \} }t jdddddd�}|j|ƒ t jd ddddd	d
�}|j|ƒ t jd!dddddd�}|j|ƒ t jd"ddddddd�}|j|ƒ |jdddgdddgdddgddd� |jdddgdddgdddgdddd
� |jd#dƒ |jd$dƒ |jddd� d S )%Nr   g333333Ó?ZxxzPatch
default color
filled)Úhatchr   ç…ëQ¸Õ?z||ZC1zPatch
explicit color
filled)rn   Ú	edgecolorr   çš™™™™™Ù?FzPatch
default color
unfilled)rn   Úfillr   zPatch
explicit color
unfilled)rn   rr   rp   r   g333333Ã?gš™™™™™é?gÍÌÌÌÌÌì?g      ð?ú+zPath
default colorg¸…ëQ¸Þ?g)\�Âõ(ä?ZC2zPath
explicit colorg{®Gáz„?gš™™™™™ñ?r@   )ZhandlelengthZhandleheight)r   r   )ro   r   )r   rq   )ro   rq   g{®Gáz„¿g{®Gáz„¿)r   r   Z	RectangleZ	add_patchZfill_betweenr<   r=   r   )r"   r#   Úpatchr(   r(   r)   Útest_hatchingÂ   s*    




ru   c              C   sl   t jƒ } | jdddƒ}|jtdƒƒ}| j|dƒ}|jƒ  | jg ksFt‚|jdƒ}|jƒ  |j	ƒ d ksht‚d S )Nr   r   Útest)
r   r2   r3   r5   rU   r   ÚremoveZlegendsÚAssertionErrorZ
get_legend)r"   r#   ÚlinesrX   r(   r(   r)   Útest_legend_removeá   s    
rz   c               @   sL   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dd„ Z
dS )ÚTestLegendFunctionc             C   sJ   t jtdƒƒ}tjdƒ�}t j|dgƒ W d Q R X |jt jƒ |dgƒ d S )Nr   zmatplotlib.legend.Legendzhello world)r   r5   rU   r   rt   r   Úassert_called_withÚgca)Úselfry   ÚLegendr(   r(   r)   Útest_legend_handle_labelï   s    z+TestLegendFunction.test_legend_handle_labelc             C   sH   t jtdƒdd�}tjdƒ�}t jƒ  W d Q R X |jt jƒ |dgƒ d S )Nr   zhello world)r   zmatplotlib.legend.Legend)r   r5   rU   r   rt   r   r|   r}   )r~   ry   r   r(   r(   r)   Útest_legend_no_argsõ   s    z&TestLegendFunction.test_legend_no_argsc             C   sL   t jtdƒdd�}tjdƒ�}t jdgƒ W d Q R X |jt jƒ |dgƒ d S )Nr   zhello world)r   zmatplotlib.legend.LegendÚfoobar)r   r5   rU   r   rt   r   r|   r}   )r~   ry   r   r(   r(   r)   Útest_legend_label_argsû   s    z)TestLegendFunction.test_legend_label_argsc             C   sV   t jtdƒdd�}tjdƒ�}t j|dgdd� W d Q R X |jt jƒ |dgdd� d S )Nr   zhello world)r   zmatplotlib.legend.Legendr‚   rg   )r   )r   r5   rU   r   rt   r   r|   r}   )r~   ry   r   r(   r(   r)   Útest_legend_three_args  s    z)TestLegendFunction.test_legend_three_argsc             C   s^   t jtdƒdd�}tjdƒ�"}|dgf|_t jddid� W d Q R X |jt jƒ gddiƒ d S )Nr   zhello world)r   z,matplotlib.legend._get_legend_handles_labelsÚ1rH   )rL   )	r   r5   rU   r   rt   Zreturn_valuer   r|   r}   )r~   ry   Zhandles_labelsr(   r(   r)   Útest_legend_handler_map  s    
z*TestLegendFunction.test_legend_handler_mapc             C   s–   t jddƒ\}}tjddtj dƒ}|j|tj|ƒddd�\}|j|tj|ƒddd�\}tj	d	ƒ�}|j
d||fd� W d Q R X |j|||fdƒ d S )Nr   r   rH   i   Úsinr	   )r   rQ   Úcoszmatplotlib.legend.Legendr   r
   )r    r'   )r   r
   )r   r
   )r   r   r   rB   Úpir5   r‡   rˆ   r   rt   r   r|   )r~   r"   r#   ÚthÚlnsÚlncr   r(   r(   r)   Útest_kwargs  s    zTestLegendFunction.test_kwargsc             C   sª   t jddƒ\}}tjddtj dƒ}|j|tj|ƒddd�\}|j|tj|ƒddd�\}tj	t
ƒ�}|j||fdd� W d Q R X t|ƒdks�t‚t|d jƒdks¦t‚d S )Nr   r   rH   i   r‡   r	   )r   rQ   rˆ   r   r
   )r    zMYou have mixed positional and keyword arguments, some input may be discarded.)r   r
   )r   r   r   rB   r‰   r5   r‡   rˆ   ÚpytestÚwarnsÚUserWarningr   rh   rx   ÚstrÚmessage)r~   r"   r#   rŠ   r‹   rŒ   Úrecordr(   r(   r)   Útest_warn_args_kwargs  s    z(TestLegendFunction.test_warn_args_kwargsc             C   s�   ddl m} |dƒ}|jƒ }|jdddgdddgdd�\}|jdddgdddgd	d�\}tjd
ƒ�}tjƒ }W d Q R X |j|||gdd	gƒ d S )Nr   )Úhost_subplotr-   r   rH   ZDensity)r   rI   ZTemperaturezmatplotlib.legend.Legend)	Zmpl_toolkits.axes_grid1r•   Ztwinxr5   r   rt   r   r   r|   )r~   r•   ÚhostÚparrM   rN   r   rX   r(   r(   r)   Útest_parasite$  s    z TestLegendFunction.test_parasiteN)Ú__name__Ú
__module__Ú__qualname__r€   r�   rƒ   r„   r†   r�   r”   r˜   r(   r(   r(   r)   r{   í   s   	r{   c               @   sD   e Zd Zdd„ Zdd„ Zdd„ Zdd„ Zd	d
„ Zdd„ Zdd„ Z	dS )ÚTestLegendFigureFunctionc             C   sR   t jƒ \}}|jtdƒƒ}tjdƒ�}|j|dgƒ W d Q R X |j||dgƒ d S )Nr   zmatplotlib.legend.Legendzhello world)r   r   r5   rU   r   rt   r   r|   )r~   r"   r#   ry   r   r(   r(   r)   r€   5  s
    z1TestLegendFigureFunction.test_legend_handle_labelc             C   sP   t jƒ \}}|jtdƒdd�}tjdƒ�}|jƒ  W d Q R X |j||dgƒ d S )Nr   zhello world)r   zmatplotlib.legend.Legend)r   r   r5   rU   r   rt   r   r|   )r~   r"   r#   ry   r   r(   r(   r)   r�   <  s
    z,TestLegendFigureFunction.test_legend_no_argsc             C   sP   t jƒ \}}|jtdƒƒ}tjdƒ�}|jdgƒ W d Q R X |j||dgƒ d S )Nr   zmatplotlib.legend.Legendr‚   )r   r   r5   rU   r   rt   r   r|   )r~   r"   r#   ry   r   r(   r(   r)   Útest_legend_label_argC  s
    z.TestLegendFigureFunction.test_legend_label_argc             C   sV   t jƒ \}}|jtdƒƒ}tjdƒ�}|j|dgdƒ W d Q R X |j||dgdƒ d S )Nr   zmatplotlib.legend.Legendr‚   rg   )r   r   r5   rU   r   rt   r   r|   )r~   r"   r#   ry   r   r(   r(   r)   Útest_legend_label_three_argsJ  s
    z5TestLegendFigureFunction.test_legend_label_three_argsc             C   sH   t jƒ \}}|jtdƒƒ}tjtƒ� |j|dgddd� W d Q R X d S )Nr   r‚   rg   Úleft)r   )r   r   r5   rU   rŽ   ZraisesÚ	Exceptionr   )r~   r"   r#   ry   r(   r(   r)   Ú#test_legend_label_three_args_pluskwQ  s    z<TestLegendFigureFunction.test_legend_label_three_args_pluskwc             C   s~   t jddƒ\}}|d jtdƒƒ}|d jtjdƒd ƒ}tjdƒ�}|jdd||fd
� W d Q R X |j	|||fddd� d S )Nr   rH   r   r   g       @zmatplotlib.legend.Legendrg   r   r
   )r   r    r'   )r   )r   r
   )r   r
   )
r   r   r5   rU   r   r4   r   rt   r   r|   )r~   r"   Úaxsry   Úlines2r   r(   r(   r)   Útest_legend_kw_argsY  s    z,TestLegendFigureFunction.test_legend_kw_argsc             C   sŒ   t jddƒ\}}|d jtdƒƒ}|d jtjdƒd ƒ}tjtƒ�}|j	||fd
d� W d Q R X t
|ƒdksrt‚t|d jƒd	ksˆt‚d S )Nr   rH   r   r   g       @r   r
   )r    zMYou have mixed positional and keyword arguments, some input may be discarded.)r   r
   )r   r   r5   rU   r   r4   rŽ   r�   r�   r   rh   rx   r‘   r’   )r~   r"   r¢   ry   r£   r“   r(   r(   r)   r”   c  s    z.TestLegendFigureFunction.test_warn_args_kwargsN)
r™   rš   r›   r€   r�   r�   rž   r¡   r¤   r”   r(   r(   r(   r)   rœ   3  s   
rœ   Zlegend_stackplot)r+   rD   c              C   s~   t jƒ } | jdƒ}tjdddƒ}d| }d| d }d| d }|j||||d	d
dgd� |jdƒ |jdƒ |jdd� dS )z.test legend for PolyCollection using stackplotr-   r   r   g      ð?g       @r   g      @rH   Úy1Úy2Úy3)r    éF   r1   )r   N)r   r   )r   r¨   )	r   r2   r3   r   rB   Z	stackplotr<   r=   r   )r"   r#   r$   r¥   r¦   r§   r(   r(   r)   Útest_legend_stackploto  s    


r©   c              C   s<   t jƒ \} }t jƒ \}}|jtdƒtdƒƒ}|j|dƒ d S )NrI   Úfoo)r   r   r9   rU   r   )r"   r#   Zfig2Zax2Zbrsr(   r(   r)   Útest_cross_figure_patch_legend  s    r«   c           
   C   s¨   t jƒ \} }|jtjgtjgddddd�}|j|gdgƒ t jƒ \} }xJdD ]B}d	}tjjd
|ƒ\}}dtjj|ƒ }|j|||||ddd� qLW |jƒ  |jdƒ d S )Nr0   r   rI   )ÚmarkerÚ	facecolorrp   Úsr   ÚredÚgreenÚblueiî  rH   g      i@g333333Ó?Únone)r   r®   r   ÚalphaZ
edgecolorsT)r¯   r°   r±   )	r   r   r   r   Únanr   r   ZrandZgrid)r"   r#   Úhr&   Únr$   r%   Zscaler(   r(   r)   Útest_nanscatter‡  s    
r·   c              C   s¼   t jƒ \} }|jdddddd� |jdddd	dd� |jƒ }tj|gƒ\}}t|ƒd
ks\t‚t jƒ \} }|jdddddd� |jdddd	dd� |jƒ }tj|gƒ\}}t|ƒd
ks¸t‚d S )Ng        g      ð?Úkr0   rv   )r&   r¬   r   g      à?r   ÚvrH   )r   r   r   r   ÚmlegendZ_get_legend_handles_labelsrh   rx   )r"   r#   ZhlÚhandZlabr(   r(   r)   Útest_legend_repeatcheckok›  s    r¼   Znot_covering_scatterc              C   sl   dddg} x(t dƒD ]}tj|g|g| | d� qW tjdddgdd� tjƒ jdd
ƒ tjƒ jdd
ƒ d S )Nr
   r   r   rI   )r&   rª   r1   )r   g      à?gš™™™™™@g      à¿g      à¿)rU   r   r   r   r}   r<   r=   )r!   r¶   r(   r(   r)   Útest_not_covering_scatterª  s    
r½   Znot_covering_scatter_transformc              C   s^   t jƒ jddƒ} tjdddƒ}tj||ƒ tjdgdg| tjƒ j	 d� tj
ddgd	d
� d S )NrE   r   é   iè  r   )Z	transformrª   r9   r1   )r   iìÿÿÿ)ÚmtransformsZAffine2DÚ	translater   rB   r   r5   r   r}   Z	transDatar   )Úoffsetr$   r(   r(   r)   Ú#test_not_covering_scatter_transform¶  s
    rÂ   c              C   s*  ddgddgg} ddgdd	ggddgdd
ggg}ddgdd	ggddgd
d
ggg}t j| ddd�}t j|dd�}t j|ddd�}tjƒ \}}|j|ƒ |j|ƒ |j|ƒ |j|||gdddgƒ}|j\}	}
}xXt|||f|	|
|fƒD ]>\}}|jƒ d d |j	k�st
‚|jƒ d d |jksät
‚qäW d S )Nr   ç      à?r   ç333333Ó?ç333333ã?çš™™™™™É?gffffffæ?gš™™™™™é?gš™™™™™Ù?gš™™™™™¹?z--rI   )Ú
linestylesrQ   z-.)rÇ   ú:Zline1Zline2zline 3)r   rÃ   )rÃ   r   )rÄ   rÅ   )rÆ   rÆ   )ÚmcollectionsZLineCollectionr   r   Zadd_collectionr   ÚlegendHandlesr   Zget_linestylesZ_dashSeqrx   Z_dashOffset)Zlines1r£   Zlines3Zlc1Zlc2Zlc3r"   r#   rX   Úh1Úh2Úh3ZohÚlhr(   r(   r)   Ú!test_linecollection_scaled_dashesÃ  s      


 rÏ   c              C   s.   t jƒ \} }|jtdƒdd� |jdd� dS )z(Test legend handler with numpoints <= 1.r	   rv   )r   g      à?)rA   N)r   r   r5   rU   r   )r"   r#   r(   r(   r)   Útest_handler_numpointsØ  s    rÐ   c              C   sD   t jƒ \} }|jtdƒdd� |jddd�}|jƒ jƒ dks@t‚d S )Nr.   rv   )r   TÚw)r^   r­   r   )r   r   r5   rU   r   Z	get_frameZ	get_alpharx   )r"   r#   rX   r(   r(   r)   Útest_shadow_framealphaà  s    rÒ   c              C   sL   t jƒ \} }|jtdƒƒ |jƒ }|jƒ jƒ dks6t‚|jƒ jƒ  sHt‚d S )Nr   Ú )	r   r   r5   rU   r   Ú	get_titleZget_textrx   Zget_visible)r"   r#   rX   r(   r(   r)   Útest_legend_title_emptyé  s
    rÕ   c              C   s”   t jdd�\} }|jtdƒdd� |jƒ }|j| jjƒ ƒj}t jdd�\} }|jtdƒdd� |jƒ }|j| jjƒ ƒj}t	j
|d dƒ|ks�t‚d S )	Nr.   )Údpir   ÚAardvark)r   éÈ   rH   gš™™™™™¹?)r   r   r5   rU   r   Úget_window_extentÚcanvasZget_rendererZx0rŽ   Zapproxrx   )r"   r#   rX   Zx01Zx02r(   r(   r)   Ú test_legend_proper_window_extentô  s    rÛ   c              C   sP   t jdd�\} }|jtdƒdd� |jƒ }| jƒ }| jjƒ  |jƒ  |jƒ  d S )Nr.   )rÖ   r   r×   )r   )r   r   r5   rU   r   rÚ   ÚdrawrÙ   )r"   r#   rX   Zleg2r(   r(   r)   Ú"test_window_extent_cached_renderer  s    
rÝ   c              C   s@   t jƒ \} }|jtdƒƒ |jddd�}|jƒ jƒ dks<t‚d S )Nr   r×   é   )r_   Ztitle_fontsize)r   r   r5   rU   r   rÔ   Zget_fontsizerx   )r"   r#   rX   r(   r(   r)   Útest_legend_title_fontsize  s    rß   c              C   sH   t jƒ } | jƒ  st‚| jdƒ | jƒ s,t‚| jdƒ | jƒ  sDt‚d S )NTF)r   r   Zget_draggablerx   Zset_draggable)r   r(   r(   r)   Útest_get_set_draggable  s    

rà   c              C   s”   t jdddgdddd�\} }}t jƒ }x|jD ]}|jdƒ q.W |jƒ d d	… |d jƒ d d
… ksht‚|jƒ d d… |d jƒ d d… ks�t‚d S )Nr   rH   rI   g      Ð?Údatar¯   )r³   r   r&   g      ð?r8   r8   r8   r8   )r   Úhistr   rÊ   Z	set_alphaZget_facecolorrx   Zget_edgecolor)r$   r¶   Úhhr   rÎ   r(   r(   r)   Útest_alpha_handles  s    (rä   c              C   s”   t jƒ \} }|jtjdƒdd� tjtƒ�0}tddiƒ� |j	ƒ }W d Q R X | j
jƒ  W d Q R X t|ƒdkspt‚x|D ]}t|jƒdksvt‚qvW d S )NiA zIs this big data?)r   z
legend.locr1   rH   zGCreating legend with loc="best" can be slow with large amounts of data.)r   r   r5   r   r4   rŽ   r�   r�   r   r   rÚ   rÜ   rh   rx   r‘   r’   )r"   r#   ÚrecordsÚlr“   r(   r(   r)   Útest_warn_big_data_best_loc'  s    
rç   c           	   C   s^   t jƒ \} }|jtjdƒdd� tjd ƒ�}|jdƒ}| jj	ƒ  W d Q R X t
|ƒdksZt‚d S )NiA zIs this big data?)r   r1   r   )r   r   r5   r   r4   rŽ   r�   r   rÚ   rÜ   rh   rx   )r"   r#   rå   ræ   r(   r(   r)   Ú(test_no_warn_big_data_when_loc_specified7  s    
rè   )@r   ÚplatformZunittestr   Znumpyr   rŽ   Zmatplotlib.testing.decoratorsr   rS   rT   r   Z
matplotlibr[   Zmatplotlib.transformsZ
transformsr¿   Zmatplotlib.collectionsrÉ   Zmatplotlib.legend_handlerr   Zmatplotlib.legendr   rº   Zmatplotlib.cbook.deprecationr   r   r*   r6   r:   r>   rC   rG   rO   ÚgetÚmachinerY   r\   ra   rc   rd   rk   ru   rz   Úobjectr{   rœ   r©   r«   r·   r¼   r½   rÂ   rÏ   rÐ   rÒ   rÕ   rÛ   rÝ   rß   rà   rä   rç   rè   r(   r(   r(   r)   Ú<module>   sr   






 F<			