
    IR-e2                     ^    d dl mZ d dlZd dlmZ d dlmZmZ d dl	m
Z
  G d de          ZdS )    )defaultdictN)rcParams)Line2DPath)Affine2Dc                       e Zd ZdZddZd Zd Zd Zd Zd Z	d	 Z
d
 Zd Zed             Zd Zd Zd Zd Zd Zd Zd Z eddgddgg          Zd Zd ZdS )Ticksa  
    Ticks are derived from Line2D, and note that ticks themselves
    are markers. Thus, you should use set_mec, set_mew, etc.

    To change the tick size (length), you need to use
    set_ticksize. To change the direction of the ticks (ticks are
    in opposite direction of ticklabels by default), use
    set_tick_out(False).

    Note that Matplotlib's defaults dictionary :data:`~matplotlib.rcParams`
    contains default settings (color, size, width) of the form `xtick.*` and
    `ytick.*`. In a WCS projection, there may not be a clear relationship
    between axes of the projection and 'x' or 'y' axes. For this reason,
    we read defaults from `xtick.*`. The following settings affect the
    default appearance of ticks:

    * `xtick.direction`
    * `xtick.major.size`
    * `xtick.major.width`
    * `xtick.minor.size`
    * `xtick.color`

    Attributes
    ----------
    ticks_locs : dict
        This is set when the ticks are drawn, and is a mapping from axis to
        the locations of the ticks for that axis.
    Nc                    |t           d         }|                     |           |                     t           d                    |                     t           d         dk               |                                  t           d         t           d         d}|                    |           t          j        | dgdgfi | |                     d	           d
| _	        d S )Nzxtick.major.sizezxtick.minor.sizezxtick.directionoutzxtick.colorzxtick.major.width)color	linewidth        allF)
r   set_ticksizeset_minor_ticksizeset_tick_outclearupdater   __init__set_visible_axes_display_minor_ticks)selfticksizetick_outkwargsline2d_kwargss        Clib/python3.11/site-packages/astropy/visualization/wcsaxes/ticks.pyr   zTicks.__init__)   s     23H(###); <===(#45>???

m,!"56
 
 	V$$$secU<<m<<<e$$$$)!!!    c                     || _         d S Nr   )r   display_minor_tickss     r   r"   zTicks.display_minor_ticks9   s    $7!!!r   c                     | j         S r    r!   r   s    r   get_display_minor_tickszTicks.get_display_minor_ticks<   s    ((r   c                     || _         dS )zD
        set True if tick need to be rotated by 180 degree.
        N	_tick_out)r   r   s     r   r   zTicks.set_tick_out?        "r   c                     | j         S )zH
        Return True if the tick will be rotated by 180 degree.
        r'   r$   s    r   get_tick_outzTicks.get_tick_outE        ~r   c                     || _         dS )z4
        set length of the ticks in points.
        N	_ticksizer   r   s     r   r   zTicks.set_ticksizeK   r)   r   c                     | j         S )z7
        Return length of the ticks in points.
        r.   r$   s    r   get_ticksizezTicks.get_ticksizeQ   r,   r   c                     || _         dS )z:
        set length of the minor ticks in points.
        N_minor_ticksizer0   s     r   r   zTicks.set_minor_ticksizeW   s      (r   c                     | j         S )z=
        Return length of the minor ticks in points.
        r4   r$   s    r   get_minor_ticksizezTicks.get_minor_ticksize]   s     ##r   c                 "    | j         r| j        S dS )Nr   )r(   r/   r$   s    r   out_sizezTicks.out_sizec   s    > 	>!3r   c                     || _         d S r    )_visible_axes)r   visible_axess     r   r   zTicks.set_visible_axesj   s    )r   c                 r      j         dk    r j                                        S  fd j         D             S )Nr   c                 &    g | ]}|j         v |S  )world).0xr   s     r   
<listcomp>z*Ticks.get_visible_axes.<locals>.<listcomp>q   s     EEE!Q$*__A___r   )r;   r@   keysr$   s   `r   get_visible_axeszTicks.get_visible_axesm   s@    &&:??$$$EEEEt1EEEEr   c                    t          t                    | _        t          t                    | _        t          t                    | _        t          t                    | _        t          t                    | _        t          t                    | _        t          t                    | _        t          t                    | _	        d S r    )
r   listr@   pixelangledispminor_worldminor_pixelminor_angle
minor_dispr$   s    r   r   zTicks.clears   s     &&
 &&
 &&
%%	&t,,&t,,&t,,%d++r   c                    | j         |                             |           | j        |                             |           | j        |                             |           | j        |                             |           d S r    )r@   appendrH   rI   rJ   )r   axisr@   rH   rI   axis_displacements         r   addz	Ticks.add}   st    
4&&&
4&&&
4&&&	$011111r   c                     | j         S r    )rK   r$   s    r   get_minor_worldzTicks.get_minor_world   s    r   c                    | j         |                             |           | j        |                             |           | j        |                             |           | j        |                             |           d S r    )rK   rP   rL   rM   rN   )r   
minor_axisrK   rL   rM   minor_axis_displacements         r   	add_minorzTicks.add_minor   sz     	$++K888$++K888$++K888
#**+BCCCCCr   c                 *    t          | j                  S r    )lenr@   r$   s    r   __len__zTicks.__len__   s    4:r   r   g      ?c                    t          t                    | _        |                                 sdS |                    |                                           }|                     || j        | j        |           | j	        rK|                    | 
                                          }|                     || j        | j        |           dS dS )z!
        Draw the ticks.
        N)r   rG   
ticks_locsget_visiblepoints_to_pixelsr2   _draw_ticksrH   rI   r   r7   rL   rM   )r   rendereroffsets      r   drawz
Ticks.draw   s     &d++!! 	F**4+<+<+>+>??4:tz6BBB$ 	S..t/F/F/H/HIIFXt'79I6RRRRR	S 	Sr   c           
         |                                  }|                                }|                    |                                            |                    |                                            |                    |                                            t                      	                    ||          }t                      }||z   }	| 
                                rdnd}
|                                 D ]}||vrt          ||         ||                   D ]\  }}|                    |
|z              |                    t          j        ||g                    }|                    || j        |	t'          |          |                                           |                                 | j        |                             |           |                                 dS )z'
        Draw the minor ticks.
        g     f@r   N)get_transformnew_gcset_foreground	get_color	set_alpha	get_alphaset_linewidthget_linewidthr   scaler+   rE   zip
rotate_degtransform_non_affinenparraydraw_markers_tickvert_pathr   
get_affiner   r^   rP   restore)r   rb   pixel_arrayangle_arrayrc   
path_transgcmarker_scalemarker_rotationmarker_transforminitial_anglerQ   locrI   locss                  r   ra   zTicks._draw_ticks   s    ''))
__
$..**+++
T^^%%&&&
++--...zz''77"**'/9!%!2!2!4!4=#))++ 	3 	3D;&&!+d"3[5FGG 3 3
U**=5+@AAA "66rxc
7K7KLL%%'$JJ))++    %%'''%,,T2222#3& 	

r   )NN)__name__
__module____qualname____doc__r   r"   r%   r   r+   r   r2   r   r7   propertyr9   r   rE   r   rS   rU   rY   r\   r   ru   rd   ra   r?   r   r   r	   r	      ss        :* * * * 8 8 8) ) )" " "  " " "  ( ( ($ $ $   X* * *F F F, , ,2 2 2     D D D   TC:Sz233NS S S( ( ( ( (r   r	   )collectionsr   numpyrr   
matplotlibr   matplotlib.linesr   r   matplotlib.transformsr   r	   r?   r   r   <module>r      s    $ # # # # #           ) ) ) ) ) ) ) ) * * * * * *    F     r   