Ë
    íÍ:jz2  ã                   ó¶   — d dl Z d dlZd dlZd dlmZmZmZ d dlm	Z
 d dlmZmZ d dlmZ d dlmZ  G d„ de«      ZdZej(                  j+                  e¬	«       y)
é    N)Ú_apiÚ
_docstringÚ
transforms)Ú	_AxesBaseÚ_TransformedBoundsLocator)ÚAxis)Ú	Transformc                   ó:  ‡ — e Zd ZdZdˆ fd„	Zd„ Zdd„Zdˆ fd„	Z ej                  e
j                  «      ˆ fd„«       Z ej                  e
j                  «      ˆ fd„«       Z ej                  ej                  «      d„ «       Zd	„ Zˆ fd
„Zd„ Zd„ Zd„ Zd„ Zˆ xZS )ÚSecondaryAxisz4
    General class to hold a Secondary_X/Yaxis.
    c                 óÒ  •— t        j                  ddg|¬«       || _        || _        || _        d| _        | j                  j                  d¬«      }| j                  dk(  r7t        ‰	| �   |g d¢fi |¤Ž | j                  | _
        ddg| _        d	d
g| _        n6t        ‰	| �   |g d¢fi |¤Ž | j                  | _
        d
d	g| _        ddg| _        d| _        | j                  ||«       | j!                  |«       | j                  dk(  r| j                  n| j                  }|j#                  t%        j&                  «       «       |j)                  d«       | j*                  | j                     j-                  d«       | j*                  | j                     j-                  d«       | j.                  dk  r| j                  ddd…   | _        | j1                  | j                  d   «       y)zÎ
        See `.secondary_xaxis` and `.secondary_yaxis` for the doc string.
        While there is no need for this to be private, it should really be
        called by those higher level functions.
        ÚxÚy)ÚorientationF)Úroot)r   ç      ð?é   ç-Cëâ6?ÚtopÚbottomÚleftÚright)r   r   r   r   NÚnoneTg      à?éÿÿÿÿr   )r   Úcheck_in_listÚ
_functionsÚ_parentÚ_orientationÚ
_ticks_setÚ
get_figureÚsuperÚ__init__ÚxaxisÚ_axisÚ_locstringsÚ_otherstringsÚyaxisÚ_parentscaleÚset_locationÚset_functionsÚset_major_locatorÚmtickerÚNullLocatorÚset_ticks_positionÚspinesÚset_visibleÚ_posÚset_alignment)
ÚselfÚparentr   ÚlocationÚ	functionsÚ	transformÚkwargsÚfigÚ	otheraxisÚ	__class__s
            €út/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/matplotlib/axes/_secondary_axes.pyr!   zSecondaryAxis.__init__   s¯  ø€ ô 	×Ñ˜C ˜:°;Õ?Ø#ˆŒØˆŒØ'ˆÔØˆŒà�l‰l×%Ñ%¨5Ð%Ó1ˆØ×Ñ Ò#Ü‰GÑ˜SÒ"4Ñ?¸Ò?ØŸ™ˆDŒJØ % xÐ0ˆDÔØ"(¨'Ð!2ˆDÕä‰GÑ˜SÒ"4Ñ?¸Ò?ØŸ™ˆDŒJØ '¨Ð0ˆDÔØ"'¨Ð!2ˆDÔØ ˆÔð 	×Ñ˜( IÔ.Ø×Ñ˜9Ô%ð #'×"3Ñ"3°sÒ":�D—J’JÀÇ
Á
ˆ	Ø×#Ñ#¤G×$7Ñ$7Ó$9Ô:Ø×$Ñ$ VÔ,à�‰�D×&Ñ&Ñ'×3Ñ3°EÔ:Ø�‰�D×$Ñ$Ñ%×1Ñ1°$Ô7à�9‰9�sŠ?à#×/Ñ/±°"°Ñ5ˆDÔØ×Ñ˜4×+Ñ+¨AÑ.Õ/ó    c                 ó°  — t        j                  | j                  |¬«       || j                  d   k(  r| j                  ddd…   | _        | j                  | j                  d      j	                  d«       | j                  | j                  d      j	                  d«       | j
                  j                  |«       | j
                  j                  |«       y)a<  
        Set if axes spine and labels are drawn at top or bottom (or left/right)
        of the Axes.

        Parameters
        ----------
        align : {'top', 'bottom', 'left', 'right'}
            Either 'top' or 'bottom' for orientation='x' or
            'left' or 'right' for orientation='y' axis.
        )Úalignr   Nr   r   TF)r   r   r$   r.   r/   r#   r-   Úset_label_position)r2   r>   s     r;   r1   zSecondaryAxis.set_alignment=   s¬   € ô 	×Ñ˜4×+Ñ+°5Õ9Ø�D×$Ñ$ QÑ'Ò'Ø#×/Ñ/±°"°Ñ5ˆDÔØ�‰�D×$Ñ$ QÑ'Ñ(×4Ñ4°TÔ:Ø�‰�D×$Ñ$ QÑ'Ñ(×4Ñ4°UÔ;Ø�
‰
×%Ñ% eÔ,Ø�
‰
×%Ñ% eÕ,r<   c                 óô  — t        j                  t        j                  df|¬«       t	        |t
        «      r/t        j                  | j                  |¬«       |dv rdnd| _        nPt	        |t        j                  «      r|| _        n.t        d| j                  d   ›d	| j                  d
   ›d|›�«      ‚|| _        | j                  dk(  r=d| j                  ddg}|�gt        j                  | j                  j                   |«      }n<| j                  ddd
g}|�*t        j                  || j                  j                   «      }|€| j                  j                   }| j#                  t%        ||«      «       y)a   
        Set the vertical or horizontal location of the axes in
        parent-normalized coordinates.

        Parameters
        ----------
        location : {'top', 'bottom', 'left', 'right'} or float
            The position to put the secondary axis.  Strings can be 'top' or
            'bottom' for orientation='x' and 'right' or 'left' for
            orientation='y'. A float indicates the relative position on the
            parent Axes to put the new Axes, 0.0 being the bottom (or left)
            and 1.0 being the top (or right).

        transform : `.Transform`, optional
            Transform for the location to use. Defaults to
            the parent's ``transAxes``, so locations are normally relative to
            the parent axes.

            .. versionadded:: 3.9
        N)r6   )r4   )r   r   r   g        zlocation must be r   z, r   z, or a float, not r   g»½×Ùß|Û=)r   Úcheck_isinstancer   r	   Ú
isinstanceÚstrr   r$   r0   ÚnumbersÚRealÚ
ValueErrorÚ_locr   Úblended_transform_factoryr   Ú	transAxesÚset_axes_locatorr   )r2   r4   r6   Úboundss       r;   r(   zSecondaryAxis.set_locationP   sc  € ô, 	×Ñœz×3Ñ3°TÐ:ÀiÕPô �h¤Ô$Ü×Ñ˜t×/Ñ/¸(ÕCØ&Ð*:Ñ:™ÀˆD�IÜ˜¤'§,¡,Ô/Ø ˆD�IäØ# D×$4Ñ$4°QÑ$7Ð#:¸"Ø×#Ñ# AÑ&Ð)Ð);¸H¸<ðIóJð Jð ˆŒ	à×Ñ Ò#ð ˜Ÿ™ B¨Ð.ˆFð
 Ð$Ü&×@Ñ@Ø—L‘L×*Ñ*¨Ió7‘	ð —i‘i  E¨1Ð-ˆFØÐ$Ü&×@Ñ@Ø˜tŸ|™|×5Ñ5ó7�	ð ÐØŸ™×.Ñ.ˆIð 	×ÑÔ7¸À	ÓJÕKr<   c                 óD   •— | j                  «        t        ‰| �	  |«       y ©N)Ú	_set_limsr    Úapply_aspect)r2   Úpositionr:   s     €r;   rO   zSecondaryAxis.apply_aspect�   s   ø€ à�‰ÔÜ‰Ñ˜XÕ&r<   c                 óh   •— | j                   dk(  rt        d«      ‚t        ‰| �  |i |¤Ž}d| _        |S )Nr   z'Cannot set xticks on a secondary y-axisT)r   Ú	TypeErrorr    Ú
set_xticksr   ©r2   Úargsr7   Úretr:   s       €r;   rS   zSecondaryAxis.set_xticks•   ó=   ø€ à×Ñ Ò#ÜÐEÓFÐFÜ‰gÑ  $Ð1¨&Ñ1ˆØˆŒØˆ
r<   c                 óh   •— | j                   dk(  rt        d«      ‚t        ‰| �  |i |¤Ž}d| _        |S )Nr   z'Cannot set yticks on a secondary x-axisT)r   rR   r    Ú
set_yticksr   rT   s       €r;   rY   zSecondaryAxis.set_yticks�   rW   r<   c                 óL   —  | j                   j                  |i |¤Ž}d| _        |S )NT)r#   Ú	set_ticksr   )r2   rU   r7   rV   s       r;   r[   zSecondaryAxis.set_ticks¥   s)   € à"ˆd�j‰j×"Ñ" DÐ3¨FÑ3ˆØˆŒØˆ
r<   c                 ó*  ‡— t        ‰t        «      r2t        ‰«      dk(  r$t        ‰d   «      rt        ‰d   «      r‰| _        n@t        ‰t
        «      r‰j                  ˆfd„f| _        n‰€d„ d„ f| _        nt        d«      ‚| j                  «        y)	a&  
        Set how the secondary axis converts limits from the parent Axes.

        Parameters
        ----------
        functions : 2-tuple of func, or `Transform` with an inverse.
            Transform between the parent axis values and the secondary axis
            values.

            If supplied as a 2-tuple of functions, the first function is
            the forward transform function and the second is the inverse
            transform.

            If a transform is supplied, then the transform must have an
            inverse.
        é   r   r   c                 óB   •— ‰j                  «       j                  | «      S rM   )Úinvertedr6   )r   r5   s    €r;   ú<lambda>z-SecondaryAxis.set_functions.<locals>.<lambda>Å   s   ø€ ˜9×-Ñ-Ó/×9Ñ9¸!Ó<€ r<   Nc                 ó   — | S rM   © ©r   s    r;   r`   z-SecondaryAxis.set_functions.<locals>.<lambda>È   s   € ¨€ r<   c                 ó   — | S rM   rb   rc   s    r;   r`   z-SecondaryAxis.set_functions.<locals>.<lambda>È   s   € °a€ r<   z›functions argument of secondary Axes must be a two-tuple of callable functions with the first function being the transform and the second being the inverse)	rB   ÚtupleÚlenÚcallabler   r	   r6   rF   Ú
_set_scale)r2   r5   s    `r;   r)   zSecondaryAxis.set_functions«   sŽ   ø€ ô$ �y¤%Ô(¬S°«^¸qÒ-@Ü˜ 1™Ô&¬8°I¸a±LÔ+Að (ˆD�OÜ˜	¤9Ô-à×$Ñ$Û<ðˆD�Oð ÐÙ*©KÐ8ˆD�Oäð @ó Að Að 	�‰Õr<   c                 ód   •— | j                  «        | j                  «        t        ‰| �  |«       y)zÿ
        Draw the secondary Axes.

        Consults the parent Axes for its limits and converts them
        using the converter specified by
        `~.axes._secondary_axes.set_functions` (or *functions*
        parameter when Axes initialized.)
        N)rN   rh   r    Údraw)r2   Úrendererr:   s     €r;   rj   zSecondaryAxis.drawÐ   s%   ø€ ð 	�‰Ôà�‰ÔÜ‰‰�XÕr<   c                 ó  — | j                   dk(  r1| j                  j                  j                  «       }| j                  }n0| j                  j
                  j                  «       }| j                  }|| j                  k(  ry| j                  r| j                  j                  «       } ||dk(  rdnd| j                  ddd…   ¬«       | j                  r.| j                  j                  t        j                  «      «       || _        y)z3
        Check if parent has set its scale
        r   NÚlogÚfunctionlogÚfunctionr   )r5   )r   r   r"   Ú	get_scaleÚ
set_xscaler&   Ú
set_yscaler'   r   r#   Úget_ticklocsr   r*   r+   ÚFixedLocator)r2   ÚpscaleÚ	set_scaleÚtickss       r;   rh   zSecondaryAxis._set_scaleÞ   sÒ   € ð
 ×Ñ Ò#Ø—\‘\×'Ñ'×1Ñ1Ó3ˆFØŸ™‰Ià—\‘\×'Ñ'×1Ñ1Ó3ˆFØŸ™ˆIØ�T×&Ñ&Ò&Øà�?Š?Ø—J‘J×+Ñ+Ó-ˆEñ 	 6¨U¢?‘-¸
Ø ŸO™O©D¨b¨DÑ1õ	3ð
 �?Š?Ø�J‰J×(Ñ(¬×)=Ñ)=¸eÓ)DÔEð #ˆÕr<   c                 ób  — | j                   dk(  r'| j                  j                  «       }| j                  }n&| j                  j	                  «       }| j
                  }|d   |d   k  } | j                  d   t        j                  |«      «      }|d   |d   k  }||k7  r|ddd…   } ||«       y)z‚
        Set the limits based on parent limits and the convert method
        between the parent and this secondary Axes.
        r   r   r   Nr   )	r   r   Úget_xlimÚset_xlimÚget_ylimÚset_ylimr   ÚnpÚarray)r2   ÚlimsÚset_limÚorderÚneworders        r;   rN   zSecondaryAxis._set_limsû   s¥   € ð
 ×Ñ Ò#Ø—<‘<×(Ñ(Ó*ˆDØ—m‘m‰Gà—<‘<×(Ñ(Ó*ˆDØ—m‘mˆGØ�Q‘˜$˜q™'Ñ!ˆØ!ˆt�‰˜qÑ!¤"§(¡(¨4£.Ó1ˆØ˜‘7˜T !™WÑ$ˆØ�uÒà™˜"˜‘:ˆDÙ��r<   c                 ó.   — t        j                  d«       y)zj
        Secondary Axes cannot set the aspect ratio, so calling this just
        sets a warning.
        z)Secondary Axes can't set the aspect ratioN)r   Úwarn_external)r2   rU   r7   s      r;   Ú
set_aspectzSecondaryAxis.set_aspect  s   € ô
 	×ÑÐFÕGr<   c                 ó  — | j                   | j                     }|j                  |¬«       | j                  j	                  «       D ]"  }|j
                  |u sŒ|j                  |«       Œ$ |j                  j                  |«       y)z”
        Change the color of the secondary Axes and all decorators.

        Parameters
        ----------
        color : :mpltype:`color`
        )ÚcolorsN)Ú	_axis_mapr   Úset_tick_paramsr.   ÚvaluesÚaxisÚ	set_colorÚlabel)r2   Úcolorr‹   Úspines       r;   rŒ   zSecondaryAxis.set_color  sq   € ð �~‰~˜d×/Ñ/Ñ0ˆØ×Ñ EÐÔ*Ø—[‘[×'Ñ'Ó)ò 	'ˆEØ�z‰z˜TÒ!Ø—‘ Õ&ð	'ð 	�
‰
×Ñ˜UÕ#r<   rM   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r!   r1   r(   rO   Ú	functoolsÚwrapsr   rS   rY   r   r[   r)   rj   rh   rN   r…   rŒ   Ú__classcell__)r:   s   @r;   r   r      s¬   ø„ ñõ)0òV-ó&>Lõ@'ð
 €Y‡_�_�Y×)Ñ)Ó*óó +ðð €Y‡_�_�Y×)Ñ)Ó*óó +ðð €Y‡_�_�T—^‘^Ó$ñó %ðò
#ôJò#ò:ò&Hö$r<   r   aÊ  
Warnings
--------
This method is experimental as of 3.1, and the API may change.

Parameters
----------
location : {'top', 'bottom', 'left', 'right'} or float
    The position to put the secondary axis.  Strings can be 'top' or
    'bottom' for orientation='x' and 'right' or 'left' for
    orientation='y'. A float indicates the relative position on the
    parent Axes to put the new Axes, 0.0 being the bottom (or left)
    and 1.0 being the top (or right).

functions : 2-tuple of func, or Transform with an inverse

    If a 2-tuple of functions, the user specifies the transform
    function and its inverse.  i.e.
    ``functions=(lambda x: 2 / x, lambda x: 2 / x)`` would be an
    reciprocal transform with a factor of 2. Both functions must accept
    numpy arrays as input.

    The user can also directly supply a subclass of
    `.transforms.Transform` so long as it has an inverse.

    See :doc:`/gallery/subplots_axes_and_figures/secondary_axis`
    for examples of making these conversions.

transform : `.Transform`, optional
    If specified, *location* will be
    placed relative to this transform (in the direction of the axis)
    rather than the parent's axis. i.e. a secondary x-axis will
    use the provided y transform and the x transform of the parent.

    .. versionadded:: 3.9

Returns
-------
ax : axes._secondary_axes.SecondaryAxis
    The returned Axes is overlaid on top of the original Axes and all
    components except for the complementary axis are hidden. You may modify
    the complementary axis, e.g. by setting ticks or an axis label. However,
    it is not designed to hold data, so that you should not call any
    plotting methods on it. Its limits are derived from the parent Axes via
    the specified transformation, and setting limits on the secondary axis
    (e.g., via ``set_xlim`` or ``set_ylim``) has no effect.


Other Parameters
----------------
**kwargs : `~matplotlib.axes.Axes` properties.
    Other miscellaneous Axes parameters.
)Ú_secax_docstring)r”   rD   Únumpyr}   Ú
matplotlibr   r   r   Úmatplotlib.tickerÚtickerr+   Úmatplotlib.axes._baser   r   Úmatplotlib.axisr   Úmatplotlib.transformsr	   r   r—   ÚinterpdÚregisterrb   r<   r;   ú<module>r¡      sR   ðÛ Û ã ç 3Ñ 3Ý #ß FÝ  Ý +ôU$�Iô U$ðp4Ð ðj × Ñ × Ñ Ð-=Ð Õ >r<   