3
$ßL]6  ã               @   s4  d Z ddlZddlZddlmZ ddlZddlZddlZddlj	Z
ddljZddlmZmZ ejjdd�dd„ ƒZd	d
„ Zedgdd�dd„ ƒZdd„ Zdd„ Zdd„ Zedgddgd�dd„ ƒZdd„ Zdd„ Zedgdd d!�d"d#„ ƒZed$gddgd�d%d&„ ƒZed'gd(d)�d*d+„ ƒZd,d-„ Zeƒ d.d/„ ƒZ dS )0z%
Tests specific to the lines module.
é    N)Úcycler)Úimage_comparisonÚcheck_figures_equalé   )Zrerunsc        
      C   sž   d} t jdd| ƒ}t jj| d�}tjƒ }tjdƒ}tj||ƒ}|j	dƒ t
tj|jjddd	�ƒ}|j|ƒ t
tj|jjddd	�ƒ}|| }d
}	||	k sšt‚dS )ac  
    Github issue #1256 identified a bug in Line.draw method

    Despite visibility attribute set to False, the draw method was not
    returning early enough and some pre-rendering code was executed
    though not necessary.

    Consequence was an excessive draw time for invisible Line instances
    holding a large number of points (Npts> 10**6)
    é
   é   r   é   )Úsizeéo   Fr   )ÚnumberÚrepeaté   Ni€–˜ )ÚnpÚlinspaceÚrandomÚnormalÚpltÚfigureZsubplotÚmlinesÚLine2DZset_visibleÚminÚtimeitr   ÚcanvasÚdrawZadd_lineÚAssertionError)
ÚNÚxÚyÚfigÚaxÚlZ	t_no_lineZt_invisible_lineZslowdown_factorZslowdown_threshold© r!   úC/tmp/pip-install-edjban26/matplotlib/matplotlib/tests/test_lines.pyÚtest_invisible_Line_rendering   s    


r#   c              C   sH   t jƒ } | jdddƒ}tjjdƒ |jtjjddƒd	gd�}dsDt‚d S )
Nr   r   é   é   r   )Ú
linestylesT©r   r   )r   r'   )	r   r   Úadd_subplotr   r   ÚseedÚcontourÚrandnr   )r   r   Úcsr!   r!   r"   Útest_set_line_coll_dash@   s
    r-   Zline_dashesT)Úbaseline_imagesÚremove_textc              C   s.   t jƒ } | jdddƒ}|jtdƒddd� d S )	Nr   r   r   r   é   )Ú	linestyleÚlw©r   r   )r   r3   )r   r   r(   ÚplotÚrange)r   r   r!   r!   r"   Útest_line_dashesL   s    r6   c              C   s†   t jƒ } | jdddƒ}|jtdƒdd� |jtdƒdd� |jtdƒdd� |jtdƒd	d� |jtdƒd
d� | jjƒ  ds‚t‚d S )Nr   r   Únone)ÚcolorÚrz.3r   T)r   r   r   r   )r   r   r   )r   r   r(   r4   r5   r   r   r   )r   r   r!   r!   r"   Útest_line_colorsT   s    
r:   c              C   sL   t jƒ } | jdddƒ}xdD ]}|jtd
ƒ|d� qW | jjƒ  dsHt‚d S )Nr   ú-Úsolidú--Údashedú-.Údashdotú:Údottedr   )r1   T)r;   r<   r=   r>   r?   r@   rA   rB   )r   r   r(   r4   r5   r   r   r   )r   r   Úlsr!   r!   r"   Útest_linestyle_variants`   s    
rD   c           	   C   s0   t jg g ƒ} tjtƒ� | jdƒ W d Q R X d S )NZaardvark)r   r   ÚpytestÚraisesÚ
ValueErrorZset_linestyle)Úliner!   r!   r"   Útest_valid_linestylesk   s    rI   Zdrawstyle_variantsZpng)r.   r/   Ú
extensionsc              C   s\   t jdƒ\} }dddddd g}x8t|j|ƒD ](\}}|jtdƒ|d� |jddd� q,W d S )Né   Údefaultz	steps-midz	steps-prez
steps-postZstepsiÐ  )Z	drawstyler   r   )ZxlimZylim)r   r   )r   r   )r   ÚsubplotsÚzipZflatr4   r5   Úset)r   ZaxsZdssr   Zdsr!   r!   r"   Útest_drawstyle_variantsq   s
    rP   c           	   C   s0   t jg g ƒ} tjtƒ� | jdƒ W d Q R X d S )NZfoobar)r   r   rE   rF   rG   Úset_drawstyle)rH   r!   r!   r"   Útest_valid_drawstyles   s    rR   c              C   sŒ   t jddt j dƒ} t j| ƒ}tjƒ \}}|j| |ƒ\}|jdƒ t|j	ƒ j
ƒdt| ƒ d ksdt‚|jdƒ t|j	ƒ j
ƒt| ƒksˆt‚d S )Nr   r   r   z	steps-prer   rL   )r   r   ÚpiÚsinr   rM   r4   rQ   ÚlenÚget_pathZverticesr   )r   r   r   r   rH   r!   r!   r"   Útest_set_drawstyle…   s    

"
rW   Zline_collection_dashesZmpl20)r.   r/   Ústylec              C   s@   t jƒ } | jdddƒ}tjjdƒ |jtjjddƒdgd�}d S )	Nr   r   r$   r%   r   )r&   ©r   r   )r   rY   )r   r   r(   r   r   r)   r*   r+   )r   r   r,   r!   r!   r"   Útest_set_line_coll_dash_image’   s    rZ   Zmarker_fill_stylesc              C   sê   t jdddgdddddtjdddgƒgƒ} d}tjddgƒ}tjdd	gƒ}tjƒ \}}xrttjj	ƒD ]b\}}xXttjj
ƒD ]H\}}	t| ƒ}
|j|d
 | || d|d   |d||	|	d|
|
dd� qzW qdW |jddgƒ |jddgƒ d S )Nr   r   Úgz#ff0000ÚcÚmr   Z
lightgreené	   r   g      à?r   r$   r0   )	ÚmarkerZ
markersizeZmarkerfacecoloraltZ	fillstyleÚlabelZ	linewidthr8   ZmarkeredgecolorZmarkeredgewidthg      @é›   éûÿÿÿ)Ú	itertoolsÚcycler   Úarrayr   rM   Ú	enumerater   r   Zfilled_markersZ
fillStylesÚnextr4   Zset_ylimZset_xlim)ÚcolorsZaltcolorr   r   r   r   Újr_   ÚiÚfsr8   r!   r!   r"   Útest_marker_fill_stylesœ   s*     rl   Zscaled_linesrL   )r.   rX   c        	      C   s˜   t jddƒ} tjƒ \}}dddg}ttjd ƒ}xbtt||ƒƒD ]P\}\}}xBt jdddƒD ]0}|j	| |t j
d	ƒ d
|  f||dœ|—Ž q\W q@W d S )Nr   é    r>   rB   r@   zaxes.prop_cycleg      à?r   é2   gš™™™™™¹?)r1   r2   )r   r   r   rM   r   Ú
matplotlibZrcParamsrf   rN   r4   Zones)	Úthr   r   Zlins_stylesÚcyri   rC   Zstyr2   r!   r!   r"   Útest_lw_scaling¹   s    
rr   c              C   sn   t jg g ƒ} | jtjdddgƒƒs&t‚| jtjdtjdgƒƒsBt‚| jddgtjgd  ddg ƒ sjt‚d S )Nr   r   r   r0   éd   r   )r   r   Z
_is_sortedr   re   r   Únan)rH   r!   r!   r"   Útest_nan_is_sortedÄ   s    ru   c             C   s>   | j ƒ jddgdƒ |j ƒ jdddgdddgdddgd� d S )Nr   r   z-or   )Z	markevery)rM   Ústepr4   )Zfig_testZfig_refr!   r!   r"   Útest_step_markersË   s    rw   )!Ú__doc__rc   r   r   Znumpyr   rE   ro   Zmatplotlib.linesÚlinesr   Zmatplotlib.pyplotZpyplotr   Zmatplotlib.testing.decoratorsr   r   ÚmarkZflakyr#   r-   r6   r:   rD   rI   rP   rR   rW   rZ   rl   rr   ru   rw   r!   r!   r!   r"   Ú<module>   s4   

,	