3
$ßL]f]  ã               @   s$  d Z ddlZddlZddlZddlmZmZ ddlZddl	j
ZddljZddljZddlmZmZmZ ddlmZ dd„ Zedgd	�d
d„ ƒZdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zdd„ Zedgd	�dd„ ƒZ edgd	�dd„ ƒZ!ed gd	�d!d"„ ƒZ"ed#gd	�d$d%„ ƒZ#ed&gd	�d'd(„ ƒZ$ed)gd	�d*d+„ ƒZ%ed,gd	�d-d.„ ƒZ&ed/gd	�d0d1„ ƒZ'ed2gd	�d3d4„ ƒZ(ed5gd	�d6d7„ ƒZ)ed8gd9d:�d;d<„ ƒZ*ed=gd	�d>d?„ ƒZ+ed@gd	�dAdB„ ƒZ,dCdD„ Z-dEdF„ Z.dGdH„ Z/dIdJ„ Z0dKdL„ Z1dMdN„ Z2edOgdPgdQdRij3ej4ƒ dSƒd9dT�dUdV„ ƒZ5edWgdPgd9dX�dYdZ„ ƒZ6ed[gdPgd9dX�d\d]„ ƒZ7ed^gdPgd9dX�d_d`„ ƒZ8dadb„ Z9dcdd„ Z:edegd9dPgdf�dgdh„ ƒZ;didj„ Z<ej=j>dkƒdldm„ ƒZ?ej=j>dkƒdndo„ ƒZ@ej=j>dkƒdpdq„ ƒZAedrgdPgds�dtdu„ ƒZBedvgdPgd9dkdw�dxdy„ ƒZCdzd{„ ZDdS )|z+
Tests specific to the collections module.
é    N)Úassert_array_equalÚassert_array_almost_equal)Ú
CollectionÚLineCollectionÚEventCollection)Úimage_comparisonc           
   C   sÊ   t jddddddddgƒ} t jd	d
dgƒ}d}d}d}d}ddddg}d}d}t| |||||||d�}	tjƒ }
|
jdddƒ}|j|	ƒ |jdƒ | ||||||||dœ	}|jddƒ |j	ddƒ ||	|fS )z5
    generate the initial collection and plot it
    g        g      ð?g       @g      @g      @g       @g      *@g      5@g      A@g     €K@g     @V@Ú
horizontalé   g      à?é   r   ÚsolidT)ÚorientationÚ
lineoffsetÚ
linelengthÚ	linewidthÚcolorÚ	linestyleÚantialiasedzEventCollection: default)	Ú	positionsÚextra_positionsr   r   r   r   r   r   r   é   éÿÿÿÿ)
ÚnpÚarrayr   ÚpltÚfigureÚadd_subplotÚadd_collectionÚ	set_titleÚset_xlimÚset_ylim)r   r   r   r   r   r   r   r   r   ÚcollÚfigÚspltÚprops© r$   úI/tmp/pip-install-edjban26/matplotlib/matplotlib/tests/test_collections.pyÚgenerate_EventCollection_plot   sB    

r&   ZEventCollection_plot__default)Úbaseline_imagesc              C   s0   t ƒ \} }}t||d |d |d |d ƒ dS )zN
    check to make sure the default segments have the correct coordinates
    r   r   r   r   N)r&   Úcheck_segments)Ú_r    r#   r$   r$   r%   Ú#test__EventCollection__get_segments=   s    r*   c              C   s&   t ƒ \} }}tjj|d |jƒ ƒ dS )zL
    check to make sure the default positions match the input positions
    r   N)r&   r   Útestingr   Úget_positions)r)   r    r#   r$   r$   r%   Ú$test__EventCollection__get_positionsJ   s    r-   c              C   s$   t ƒ \} }}|d |jƒ ks t‚dS )zV
    check to make sure the default orientation matches the input
    orientation
    r   N)r&   Úget_orientationÚAssertionError)r)   r    r#   r$   r$   r%   Ú&test__EventCollection__get_orientationR   s    r0   c              C   s   t ƒ \} }} |jƒ st‚dS )zV
    check to make sure the default orientation matches the input
    orientation
    N)r&   Úis_horizontalr/   )r)   r    r$   r$   r%   Ú$test__EventCollection__is_horizontal[   s    r2   c              C   s$   t ƒ \} }}|d |jƒ ks t‚dS )zP
    check to make sure the default linelength matches the input linelength
    r   N)r&   Úget_linelengthr/   )r)   r    r#   r$   r$   r%   Ú%test__EventCollection__get_linelengthd   s    r4   c              C   s$   t ƒ \} }}|d |jƒ ks t‚dS )zP
    check to make sure the default lineoffset matches the input lineoffset
    r   N)r&   Úget_lineoffsetr/   )r)   r    r#   r$   r$   r%   Ú%test__EventCollection__get_lineoffsetl   s    r6   c              C   s"   t ƒ \} }} |jƒ dgkst‚dS )zN
    check to make sure the default linestyle matches the input linestyle
    N)NN)r&   Úget_linestyler/   )r)   r    r$   r$   r%   Ú$test__EventCollection__get_linestylet   s    r8   c              C   s8   t ƒ \} }}tjj|d |jƒ ƒ t|jƒ |d ƒ dS )zF
    check to make sure the default color matches the input color
    r   N)r&   r   r+   r   Ú	get_colorÚcheck_allprop_arrayÚ
get_colors)r)   r    r#   r$   r$   r%   Ú test__EventCollection__get_color|   s    r<   Z#EventCollection_plot__set_positionsc              C   st   t ƒ \} }}tj|d |d gƒ}|j|ƒ tjj||jƒ ƒ t|||d |d |d ƒ | jdƒ | j	d
dƒ d	S )z9
    check to make sure set_positions works properly
    r   r   r   r   r   zEventCollection: set_positionsr	   éZ   Nr   )
r&   r   ÚhstackZset_positionsr+   r   r,   r(   r   r   )r"   r    r#   Únew_positionsr$   r$   r%   Ú$test__EventCollection__set_positions…   s    


r@   Z#EventCollection_plot__add_positionsc              C   s€   t ƒ \} }}tj|d |d d gƒ}|j|d d ƒ tjj||jƒ ƒ t|||d |d |d ƒ | jdƒ | j	dd	ƒ d
S )z9
    check to make sure add_positions works properly
    r   r   r   r   r   r   zEventCollection: add_positionsr	   é#   Nr   )
r&   r   r>   Zadd_positionsr+   r   r,   r(   r   r   )r"   r    r#   r?   r$   r$   r%   Ú$test__EventCollection__add_positions–   s    


rB   Z&EventCollection_plot__append_positionsc              C   s€   t ƒ \} }}tj|d |d d gƒ}|j|d d ƒ tjj||jƒ ƒ t|||d |d |d ƒ | jdƒ | j	dd	ƒ d
S )z<
    check to make sure append_positions works properly
    r   r   r
   r   r   r   z!EventCollection: append_positionsr	   r=   Nr   )
r&   r   r>   Zappend_positionsr+   r   r,   r(   r   r   )r"   r    r#   r?   r$   r$   r%   Ú'test__EventCollection__append_positions©   s    


rC   Z&EventCollection_plot__extend_positionsc              C   sˆ   t ƒ \} }}tj|d |d dd… gƒ}|j|d dd… ƒ tjj||jƒ ƒ t|||d |d |d ƒ | jdƒ | j	d
d	ƒ dS )z<
    check to make sure extend_positions works properly
    r   r   r	   Nr   r   r   z!EventCollection: extend_positionsr=   r   )
r&   r   r>   Zextend_positionsr+   r   r,   r(   r   r   )r"   r    r#   r?   r$   r$   r%   Ú'test__EventCollection__extend_positions¼   s    


rD   Z(EventCollection_plot__switch_orientationc              C   s|   t ƒ \} }}d}|jƒ  ||jƒ ks(t‚|jƒ  s6t‚|jƒ }t|||d |d |ƒ | jdƒ | jd
dƒ | j	ddƒ d	S )z>
    check to make sure switch_orientation works properly
    Úverticalr   r   z#EventCollection: switch_orientationr	   r   r   r
   Nr   )
r&   Úswitch_orientationr.   r/   r1   r,   r(   r   r   r   )r"   r    r#   Únew_orientationr?   r$   r$   r%   Ú)test__EventCollection__switch_orientationÏ   s    
rH   Z,EventCollection_plot__switch_orientation__2xc              C   s€   t ƒ \} }}|jƒ  |jƒ  |jƒ }|d |jƒ ks8t‚|jƒ sDt‚tjj|d |ƒ t	|||d |d |d ƒ | j
dƒ dS )zj
    check to make sure calling switch_orientation twice sets the
    orientation back to the default
    r   r   r   r   z&EventCollection: switch_orientation 2xN)r&   rF   r,   r.   r/   r1   r   r+   r   r(   r   )r"   r    r#   r?   r$   r$   r%   Ú,test__EventCollection__switch_orientation_2xã   s    
rI   Z%EventCollection_plot__set_orientationc              C   sz   t ƒ \} }}d}|j|ƒ ||jƒ ks*t‚|jƒ  s8t‚t||d |d |d |ƒ | jdƒ | jddƒ | jdd	ƒ d
S )z;
    check to make sure set_orientation works properly
    rE   r   r   r   z EventCollection: set_orientationr	   r   r   r
   Nr   )	r&   Zset_orientationr.   r/   r1   r(   r   r   r   )r"   r    r#   rG   r$   r$   r%   Ú&test__EventCollection__set_orientationù   s    

rJ   Z$EventCollection_plot__set_linelengthc              C   s`   t ƒ \} }}d}|j|ƒ ||jƒ ks*t‚t||d ||d |d ƒ | jdƒ | jddƒ dS )	z:
    check to make sure set_linelength works properly
    é   r   r   r   zEventCollection: set_linelengthé   Niìÿÿÿ)r&   Zset_linelengthr3   r/   r(   r   r   )r"   r    r#   Znew_linelengthr$   r$   r%   Ú%test__EventCollection__set_linelength  s    


rM   Z$EventCollection_plot__set_lineoffsetc              C   s`   t ƒ \} }}d	}|j|ƒ ||jƒ ks*t‚t||d |d ||d ƒ | jdƒ | jd
dƒ dS )z:
    check to make sure set_lineoffset works properly
    g      @r   r   r   zEventCollection: set_lineoffseté   é   Ng      Àiúÿÿÿéüÿÿÿ)r&   Zset_lineoffsetr5   r/   r(   r   r   )r"   r    r#   Znew_lineoffsetr$   r$   r%   Ú%test__EventCollection__set_lineoffset  s    


rQ   Z#EventCollection_plot__set_linestylec              C   s:   t ƒ \} }}d}|j|ƒ |jƒ dgks,t‚| jdƒ dS )z9
    check to make sure set_linestyle works properly
    Údashedr   ç      @zEventCollection: set_linestyleN©rS   rS   )r   rT   )r&   Úset_linestyler7   r/   r   )r"   r    r)   Únew_linestyler$   r$   r%   Ú$test__EventCollection__set_linestyle1  s
    
rW   Z!EventCollection_plot__set_ls_dashT)r'   Úremove_textc              C   s:   t ƒ \} }}d}|j|ƒ |jƒ dgks,t‚| jdƒ dS )	zH
    check to make sure set_linestyle accepts a single dash pattern
    r   ç      @zEventCollection: set_linestyleN©rY   rY   )r   rZ   ©rY   rY   )r   r[   )r&   rU   r7   r/   r   )r"   r    r)   rV   r$   r$   r%   Ú0test__EventCollection__set_linestyle_single_dash=  s
    
r\   Z#EventCollection_plot__set_linewidthc              C   s8   t ƒ \} }}d}|j|ƒ |jƒ |ks*t‚| jdƒ dS )z9
    check to make sure set_linestyle works properly
    é   zEventCollection: set_linewidthN)r&   Zset_linewidthZget_linewidthr/   r   )r"   r    r)   Znew_linewidthr$   r$   r%   Ú$test__EventCollection__set_linewidthJ  s
    
r^   ZEventCollection_plot__set_colorc              C   sV   t ƒ \} }}tjddddgƒ}|j|ƒ tjj||jƒ ƒ t|jƒ |ƒ | j	dƒ dS )z5
    check to make sure set_color works properly
    r   r	   zEventCollection: set_colorN)
r&   r   r   Ú	set_colorr+   r   r9   r:   r;   r   )r"   r    r)   Z	new_colorr$   r$   r%   Ú test__EventCollection__set_colorV  s    
r`   c       
      C   sÒ   | j ƒ }|jƒ dks(|jƒ dks(|dkr2d}d}n|jƒ dkrHd}d}ntdƒ‚x|t|ƒD ]p\}}	|	d|f ||d  ks~t‚|	d|f ||d  ksšt‚|	d|f || ks²t‚|	d|f || ksZt‚qZW dS )	z›
    check to make sure all values in the segment are correct, given a
    particular set of inputs

    note: this is not a test, it is used by tests
    r   ÚnoneNr	   r   rE   z.orientation must be 'horizontal' or 'vertical'r
   )Zget_segmentsÚlowerÚ
ValueErrorÚ	enumerater/   )
r    r   r   r   r   ÚsegmentsZpos1Úpos2ÚiÚsegmentr$   r$   r%   r(   c  s    r(   c             C   s    x| D ]}t jj||ƒ qW dS )z{
    check to make sure all values match the given target if arrays

    note: this is not a test, it is used by tests
    N)r   r+   r   )ÚvaluesÚtargetÚvaluer$   r$   r%   r:     s    
r:   c              C   s4   t jg ƒ} | jtjƒ ƒ}t|jƒ tjjƒ jƒ ƒ d S )N)	ÚmcollectionsÚPathCollectionÚget_datalimÚmtransformsZIdentityTransformr   Z
get_pointsZBboxÚnull)ÚcolZcol_data_limr$   r$   r%   Útest_null_collection_datalim‰  s    
rr   c              C   sV   t jƒ  t jƒ } | jddgddgƒ}| j|ƒ | jj}| jg g ƒ}| jj|ksRt‚d S )Nr   r	   )r   r   ÚaxesÚscatterr   ÚdataLimÚboundsr/   )Úaxr    rv   r$   r$   r%   Útest_add_collection�  s    
rx   c              C   sä   t jƒ } tjdƒtjdƒ }}tjdddƒjddƒ }}t j||||ƒ}|j| jƒj	dks^t
‚t jƒ  t jƒ } tjddd	ƒ}tjdddƒ}tj||ƒ\}}tjƒ jddƒ| j }t j||tj|ƒtj|ƒ|d� | jj	dksàt
‚d S )Né   é
   r   éP   ç        ç      @ç      "@r]   rL   r
   rO   é   é    )Ú	transformç      4@ç      >@ç      .@ç      @)r|   r|   r}   r~   éûÿÿÿéþÿÿÿ)r‚   rƒ   r„   r…   )r   rs   r   ÚarangeÚlinspaceZreshapeZquiverrn   Ú	transDatarv   r/   r   Úmeshgridro   ÚAffine2DÚ	translateÚsinÚcosru   )rw   ÚxÚyÚuÚvÚqÚtransr$   r$   r%   Útest_quiver_limitsœ  s     r–   c              C   s€   t jƒ } tjdddƒ}tjdddƒ}tj||ƒ\}}tjƒ jddƒ| j }t j	||tj
|ƒtj|ƒ|d� t| jjddd� d S )Nr]   rz   rL   r
   rO   r   r€   )r�   é   rK   rN   r	   )Údecimalr†   r‡   )rL   r—   rK   rN   )r   rs   r   r‰   r‹   ro   rŒ   r�   rŠ   ZbarbsrŽ   r�   r   ru   rv   )rw   r�   r‘   r•   r$   r$   r%   Útest_barb_limits­  s     
r™   ZEllipseCollection_test_imageZpngZaarch64g{®Gáz”?g        )r'   Ú
extensionsZtolrX   c           	   C   sž   t jƒ \} }tjdƒ}tjdƒ}tj||ƒ\}}tj|jƒ |jƒ fƒj}||d  }||d	  }tj|ƒd }	t	j
|||	d||jdd�}
|j|
ƒ |jƒ  d S )
NrO   é   r	   rL   r�   ra   )ÚunitsÚoffsetsÚtransOffsetÚ
facecolorsr   r   )r   Úsubplotsr   rˆ   r‹   ZvstackZravelÚTZ	ones_likerl   ÚEllipseCollectionrŠ   r   Úautoscale_view)r!   rw   r�   r‘   ÚXÚYZXYZwwÚhhÚaaÚecr$   r$   r%   Útest_EllipseCollection»  s    



r©   Zpolycollection_close)r'   rš   rX   c              C   sL  ddl m}  ddgddgddgddggddgddgddgddggddgddgddgddggddgddgddgddggg}tjƒ }| |ƒ}dd	d
ddg}ttdƒƒ}tj|t|ƒ dd�}|j	dƒ g }g }x>t
||ƒD ]0\}	}
|j|	gt|ƒ ƒ |j|
gt|ƒ ƒ qÖW |j|ƒ |j||dd� |jddƒ |jddƒ |jddƒ d S )Nr   )ÚAxes3Dg        g      ð?g       @g      @g      @ÚrÚgÚbr‘   Úkr]   g      Ð?)r   gffffffæ?)ÚzsZzdirrO   r›   )Zmpl_toolkits.mplot3drª   r   r   ÚlistÚrangerl   ZPolyCollectionÚlenÚ	set_alphaÚzipÚextendr_   Zadd_collection3dZ
set_xlim3dZ
set_zlim3dZ
set_ylim3d)rª   Z	vertsQuadr!   rw   ÚcolorsZzposÚpolyr¯   ÚcsÚzÚcr$   r$   r%   Útest_polycollection_closeÔ  s,    

r»   Zregularpolycollection_rotatec        	      C   sž   t jd d…d d…f \} }t j| jƒ |jƒ gƒ}t jddt j t|ƒƒ}tjƒ \}}x<t	||ƒD ].\}}t
jdd	||g|jd�}|j|dd� q`W |jƒ  d S )
Nrz   r   r
   rO   éd   )ÚsizesÚrotationr�   rž   T)Úautolim)r¼   )r   ZmgridZ	transposeÚflattenr‰   Úpir²   r   r    r´   rl   ÚRegularPolyCollectionrŠ   r   r£   )	ZxxÚyyZ	xy_pointsZ	rotationsr!   rw   ÚxyÚalpharq   r$   r$   r%   Ú!test_regularpolycollection_rotateú  s    rÆ   Zregularpolycollection_scalec              C   sd   G dd„ dt jƒ} tjƒ \}}d	g}tjd g}| |||jd�}|j|dd� |jd
dddgƒ d S )Nc                   s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )z:test_regularpolycollection_scale.<locals>.SquareCollectionc                s    t ƒ jddtjd i|—Ž d S )NrO   r¾   g      @)rO   )ÚsuperÚ__init__r   rÁ   )ÚselfÚkwargs)Ú	__class__r$   r%   rÈ     s    zCtest_regularpolycollection_scale.<locals>.SquareCollection.__init__c             S   sJ   | j }d|jj }||jj |jj }||jj |jj }tjƒ j	||ƒS )z4Return transform scaling circle areas to data space.g      R@)
rs   r   ÚdpiZbboxÚwidthZviewLimÚheightro   rŒ   Zscale)rÉ   rw   Z
pts2pixelsZscale_xZscale_yr$   r$   r%   Úget_transform  s
    zHtest_regularpolycollection_scale.<locals>.SquareCollection.get_transform)Ú__name__Ú
__module__Ú__qualname__rÈ   rÏ   Ú__classcell__r$   r$   )rË   r%   ÚSquareCollection  s   rÔ   r   r
   )r½   r�   rž   T)r¿   r	   )r   r   r   r   )	rl   rÂ   r   r    r   rÁ   rŠ   r   Zaxis)rÔ   r!   rw   rÄ   Zcircle_areasZsquaresr$   r$   r%   Ú test_regularpolycollection_scale
  s    
rÕ   c              C   s„   t jƒ \} }|jdgdgdgdd�}| jtjƒ | jd� G dd„ dtƒ}|ƒ }d|_d	|_	|j
|ƒ\}}|spt‚t|d
 dgƒ d S )Nr   iè  T)Zpicker)rÌ   c               @   s   e Zd ZdS )z test_picking.<locals>.MouseEventN)rÐ   rÑ   rÒ   r$   r$   r$   r%   Ú
MouseEvent.  s   rÖ   iE  éð   Úind)r   r    rt   ZsavefigÚioÚBytesIOrÌ   Úobjectr�   r‘   Úcontainsr/   r   )r!   rw   rq   rÖ   ÚeventÚfoundÚindicesr$   r$   r%   Útest_picking)  s    rà   c               C   s0   t jdddgdddgdddgfd� t jƒ  d S )Nr   r	   r
   g        g       @)r   )r   rt   Údrawr$   r$   r$   r%   Útest_linestyle_single_dashes9  s    $râ   Z
size_in_xy)r'   rX   rš   c              C   s`   t jƒ \} }d\}}}d	}d
dg}tj|||d||jd�}|j|ƒ |jddƒ |jddƒ d S )Nrz   r   rK   rÄ   )rœ   r�   rž   r—   ©rz   rz   )rã   rz   r   )rz   rz   )rz   rz   )rK   rK   )r   r    rl   r¢   rŠ   r   r   r   )r!   rw   ZwidthsZheightsZanglesZcoordsÚer$   r$   r%   Útest_size_in_xy>  s    


rå   c             C   s”   dddg}| j dddg|d� }}| j dd	d
g|d�}| j dddg|d�}| j dddg|d�}t|d� t|d� t|d� t|d� t|d� d S )Né   é   é   ÚredZblueZgreen)Úindexr	   r
   r›   r   rR   ZdashdotTF)Z
edgecolors)rŸ   )Ú
linewidths)Z
linestyles)Zantialiaseds)ZSeriesr   )Úpdrê   r¨   ZfcZlwZlsr§   r$   r$   r%   Útest_pandas_indexingR  s    




rí   Údefaultc              C   sœ   t jg ƒ} | jddgƒ | jdddgƒ | jƒ dgd ks>t‚| jƒ dddgd ksXt‚| jdddgƒ | jƒ dgd ks~t‚| jƒ dddgkjƒ s˜t‚d S )Nú-r	   r
   r›   rN   )NN)NN)rl   rm   Zset_linestylesZset_linewidthsZget_linestylesr/   Zget_linewidthsÚall)rq   r$   r$   r%   Útest_lslw_bcastc  s    
rñ   c              C   s<   t jg dd�} | jƒ dkst‚| jdƒ | jƒ dks8t‚d S )NÚround)ZcapstyleZbutt)rl   rm   Zget_capstyler/   Úset_capstyle)rq   r$   r$   r%   Útest_capstyleq  s    
rô   c              C   s<   t jg dd�} | jƒ dkst‚| jdƒ | jƒ dks8t‚d S )Nrò   )Z	joinstyleÚmiter)rl   rm   Zget_joinstyler/   Úset_joinstyle)rq   r$   r$   r%   Útest_joinstyley  s    
r÷   Zcap_and_joinstyle)r'   rš   c              C   sÞ   t jƒ } | jdddƒ}|jddgƒ |jddgƒ tjdddgƒ}tjdgdgdggƒtjdddggƒ }tjdƒ}||d d …d d …d	f< ||d d …d d …df< t|d
ddgd�}|j	dƒ |j
dƒ |j|ƒ |jdƒ d S )Nr	   g      à?g      ø?g      @g        g      ð?r›   r
   r   rz   rK   rL   )r   rò   rõ   z2Line collection with customized caps and joinstyleg      à¿g      à¿)r›   r›   r
   )r   r   r   r   r   r   r   Úzerosr   ró   rö   r   r   )r!   rw   r�   ZysZsegsZline_segmentsr$   r$   r%   Útest_cap_and_joinstyle_image�  s    (



rù   Zscatter_post_alpha)r'   rš   rX   Ústylec              C   s@   t jƒ \} }|jtdƒtdƒtdƒd�}| jjƒ  |jdƒ d S )Nr]   )rº   gš™™™™™¹?)r   r    rt   r±   Úcanvasrá   r³   )r!   rw   Úscr$   r$   r%   Útest_scatter_post_alpha—  s    
rý   c              C   sœ  t jjdƒ t jjddƒ\} }t jjdƒ}t jjdddd�}t jjdddd�}tjƒ \}}|j| |||dd	dd
�}|jdd�\}}t	|ƒdks’t
‚tt j|ƒjtƒt jdƒƒ t jdd„ |D ƒƒ}	|jt jdƒd ƒ}
t|	|
ƒ |j||dd�}|jdd�\}}t	|ƒdk�st
‚|j||dd�}|jdddd�\}}t jdd„ |D ƒƒ}t|dƒ t jdd„ |D ƒƒ}t|dƒ |j||dd�}|jddddd„ d�\}}dd„ |D ƒ}t jt j|ƒjtƒd ƒ}t||ƒ |j||dd�}dd lj}|jdd'ddd ddd!d"dgd#�}|j|d�\}}t	|ƒt	|ƒk�s.t
‚d(dd$d%g}|j|ddd&�\}}tt j|ƒjtƒ|dd … ƒ x ||||gD ]}|j|ƒ �qzW |jjƒ  d S ))Ni!N,r
   rz   r   r]   )Úsizei,  ZjetÚo)rº   ÚsÚcmapÚmarkerrë   z{x:g})Úfmtc             S   s   g | ]}|j ƒ ‘qS r$   )r9   )Ú.0Úliner$   r$   r%   ú
<listcomp>¯  s    z7test_pathcollection_legend_elements.<locals>.<listcomp>rO   r	   )Úlocé	   )Únumr½   g      à?ré   )ÚproprÅ   r   c             S   s   g | ]}|j ƒ ‘qS r$   )Z	get_alpha)r  r  r$   r$   r%   r  ¹  s    c             S   s   g | ]}|j ƒ ‘qS r$   )Zget_markerfacecolor)r  r  r$   r$   r%   r  »  s    z{x:.2f}c             S   s   d|  S )Nr
   r$   )r�   r$   r$   r%   Ú<lambda>À  s    z5test_pathcollection_legend_elements.<locals>.<lambda>)r
  r	  r  Úfuncc             S   s   g | ]}|j ƒ ‘qS r$   )Zget_markersize)r  r  r$   r$   r%   r  Á  s    r›   g      @rN   ry   )ZnbinsZmin_n_ticksZstepsg33333³K@i  )r	  r
  r  ry   r   )r   ÚrandomÚseedZrandÚrandintr   r    rt   Zlegend_elementsr²   r/   r   r   ZastypeÚfloatrˆ   r  ZlegendÚsqrtr   Zmatplotlib.tickerZtickerZMaxNLocatorZ
add_artistrû   rá   )r�   r‘   rº   r   r!   rw   rü   ÚhÚlr¶   Zcolors2Úl1Úh2Zlab2Úl2rÅ   r   Úl3ZactsizesZlabeledsizesÚl4Zmtickerr  Úh5Zlab5ZlevelsÚh6Zlab6r$   r$   r%   Ú#test_pathcollection_legend_elements¢  sP    





r  )EÚ__doc__rÙ   ÚplatformZnumpyr   Znumpy.testingr   r   ZpytestZmatplotlib.pyplotZpyplotr   Zmatplotlib.collectionsÚcollectionsrl   Zmatplotlib.transformsZ
transformsro   r   r   r   Zmatplotlib.testing.decoratorsr   r&   r*   r-   r0   r2   r4   r6   r8   r<   r@   rB   rC   rD   rH   rI   rJ   rM   rQ   rW   r\   r^   r`   r(   r:   rr   rx   r–   r™   ÚgetÚmachiner©   r»   rÆ   rÕ   rà   râ   rå   rí   Úmarkrú   rñ   rô   r÷   rù   rý   r  r$   r$   r$   r%   Ú<module>   s€   


+			
%	