o
    ‘io  ã                   @   sö   d Z ddlmZ ddlZddlmZ ddlmZ ddl	m
Z
 ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ G dd„ dejƒZG d	d
„ d
ejƒZG dd„ dejƒZG dd„ de
ƒZeeƒ edgdddd„ ƒZedgdddd„ ƒZ dS )z)
Testing that skewed axes properly work.
é    )Ú	ExitStackN)Úimage_comparison)ÚAxes)Úregister_projectionc                       s$   e Zd Z‡ fdd„Zdd„ Z‡  ZS )Ú	SkewXTickc                    sè   t ƒ g}| j| j| j| j| jfD ]}| |j| ¡ ¡ qt	 
| jj|  ¡ ¡}t	 
| jj|  ¡ ¡}| j | j ¡ o9|¡ | j | j ¡ oD|¡ | j | j ¡ oO|¡ | j | j ¡ oZ|¡ tƒ  |¡ W d   ƒ d S 1 smw   Y  d S ©N)r   ZgridlineZ	tick1lineZ	tick2lineÚlabel1Úlabel2ÚcallbackZset_visibleZget_visibleÚ
transformsZinterval_containsÚaxesÚ
lower_xlimZget_locÚ
upper_xlimÚsuperÚdraw)ÚselfÚrendererÚstackZartistZneeds_lowerZneeds_upper©Ú	__class__© úi/var/www/html/eduruby.in/lip-sync/lip-sync-env/lib/python3.10/site-packages/matplotlib/tests/test_skew.pyr      s2   ÿÿÿÿÿÿÿ"ðzSkewXTick.drawc                 C   s   | j j ¡ S r   )r   ÚxaxisÚget_view_interval©r   r   r   r   r   )   s   zSkewXTick.get_view_interval)Ú__name__Ú
__module__Ú__qualname__r   r   Ú__classcell__r   r   r   r   r      s    r   c                   @   s   e Zd Zdd„ Zdd„ ZdS )Ú	SkewXAxisc                 C   s   t | jd |dS )N)Úmajor)r   r   )r   r    r   r   r   Ú	_get_tick0   s   zSkewXAxis._get_tickc                 C   s   | j jd | j jd fS )Nr   é   )r   r   r   r   r   r   r   r   3   s   zSkewXAxis.get_view_intervalN)r   r   r   r!   r   r   r   r   r   r   /   s    r   c                   @   s   e Zd Zdd„ ZdS )Ú	SkewSpinec                 C   sB   | j j}| jdkr| jj|d d …df< d S | jj|d d …df< d S )NÚtopr   )Ú_pathZverticesZ
spine_typer   r   r   ©r   Zptsr   r   r   Ú_adjust_location;   s   
zSkewSpine._adjust_locationN)r   r   r   r'   r   r   r   r   r#   :   s    r#   c                       sH   e Zd ZdZdd„ Zdd„ Z‡ fdd„Zedd	„ ƒZed
d„ ƒZ	‡  Z
S )Ú	SkewXAxesÚskewxc                 C   sZ   t | ƒ| _| jj | j¡ | jj | j¡ t | ¡| _| jj	 | j¡ | jj
 | j¡ d S r   )r   r   Úspinesr$   Zregister_axisÚbottomÚmaxisZYAxisZyaxisÚleftÚrightr   r   r   r   Ú
_init_axisK   s   
zSkewXAxes._init_axisc                 C   s8   t  | d¡tj | d¡tj | d¡tj | d¡dœ}|S )Nr$   r+   r-   r.   )r$   r+   r-   r.   )r#   Zlinear_spineÚmspinesÚSpine)r   r*   r   r   r   Ú_gen_axes_spinesT   s   
ýzSkewXAxes._gen_axes_spinesc                    sn   d}t ƒ  ¡  | j| jt ¡  |d¡  | _| j| j | _	t 
| j| j t ¡ ¡t ¡  |d¡ | j | _dS )z
        This is called once when the plot is created to set up all the
        transforms for the data, text and grids.
        é   r   N)r   Ú_set_lim_and_transformsZ
transScaleZtransLimitsr   ÚAffine2DÚskew_degÚtransDataToAxesZ	transAxesÚ	transDataZblended_transform_factoryZIdentityTransformZ_xaxis_transform)r   Zrotr   r   r   r4   [   s    
ÿÿ
þý
ýz!SkewXAxes._set_lim_and_transformsc                 C   s
   | j jjS r   )r   ZviewLimZ	intervalxr   r   r   r   r   x   s   
zSkewXAxes.lower_xlimc                 C   s,   ddgddgg}| j  ¡  |¡d d …df S )Ng        g      ð?r   )r7   ÚinvertedÚ	transformr&   r   r   r   r   |   s   zSkewXAxes.upper_xlim)r   r   r   Únamer/   r2   r4   Úpropertyr   r   r   r   r   r   r   r(   F   s    	
r(   Z	skew_axesT)Zremove_textc                  C   sN   t  ¡ } | jddddd}| dd¡ | dd¡ | d¡ |jddd	 d S )
Nr"   r)   )Z
projectioniÎÿÿÿé2   Tr   Úb)Úcolor)ÚpltZfigureZadd_subplotÚset_xlimÚset_ylimÚgridZaxvline)ZfigÚaxr   r   r   Útest_set_line_coll_dash_image‡   s   
rE   Z
skew_rectsc            	      C   sú   t jdddddd\} }|j}ttjg d¢ddƒ}|d  d	d
g¡ |d  d	d
g¡ |d jddd t	||ƒD ]6\}\}}d| d| }}t
 ¡  ||¡}| d|› d|› d¡ | tjddgdd||j ddd¡ q:t jdddddd d S )Né   T)é   rG   )ZsharexZshareyZfigsize)éýÿÿÿéÿÿÿÿr   r"   é   é   )Úrepeatr   rH   rJ   Úequal)Úshareé-   zSkew of z
 in X and z in YrI   g      à?Zcoral)r:   ÚalphaZ	facecolorg{®Gáz„?g®Gáz®ï?)Zwspacer-   r.   r+   r$   )r@   ZsubplotsZflatÚlistÚ	itertoolsÚproductrA   rB   Z
set_aspectÚzipr   r5   r6   Ú	set_titleZ	add_patchÚmpatchZ	Rectangler8   Zsubplots_adjust)	Zfixr   Z	rotationsrD   ZxrotsZyrotsZxdegZydegÚtr   r   r   Útest_skew_rectangle“   s   
þrX   )!Ú__doc__Ú
contextlibr   rR   Zmatplotlib.pyplotZpyplotr@   Zmatplotlib.testing.decoratorsr   Zmatplotlib.axesr   Zmatplotlib.transformsr   Zmatplotlib.axisZaxisr,   Zmatplotlib.spinesr*   r0   Zmatplotlib.patchesZpatchesrV   Zmatplotlib.projectionsr   ZXTickr   ZXAxisr   r1   r#   r(   rE   rX   r   r   r   r   Ú<module>   s(    >
