Ë
    µ2Úi(  ã                   óž   — d dl Z d dlZd dlmZmZ d dlmZ d dl	m
Z
mZ d dlmZ  G d„ de
«      ZdZej                   j#                  e¬«       y)	é    N)Ú_apiÚ
_docstring)Ú	_AxesBaseÚ_TransformedBoundsLocator)ÚAxisc                   ó®   ‡ — e Zd ZdZˆ fd„Zd„ Zd„ Zdˆ fd„	Z ej                  e
j                  «      dddœ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                  dk(  rKt        ‰| �  | j                  j                  g d¢fi |¤Ž | j                  | _
        ddg| _        dd	g| _        nJt        ‰| �  | j                  j                  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)r   ç      ð?é   ç-Cëâ6?ÚtopÚbottomÚleftÚright)r   r   r   r   NÚnoneTg      à?éÿÿÿÿr   )r   Úcheck_in_listÚ
_functionsÚ_parentÚ_orientationÚ
_ticks_setÚsuperÚ__init__ÚfigureÚ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ÚkwargsÚ	otheraxisÚ	__class__s          €úV/var/www/html/acx/venv/lib/python3.12/site-packages/matplotlib/axes/_secondary_axes.pyr   zSecondaryAxis.__init__   sª  ø€ ô 	×Ñ˜C ˜:°;Õ?Ø#ˆŒØˆŒØ'ˆÔØˆŒà×Ñ Ò#Ü‰GÑ˜TŸ\™\×0Ñ0Ò2DÑOÈÒOØŸ™ˆDŒJØ % xÐ0ˆDÔØ"(¨'Ð!2ˆDÕä‰GÑ˜TŸ\™\×0Ñ0Ò2DÑOÈÒOØŸ™ˆDŒJØ '¨Ð0ˆDÔØ"'¨Ð!2ˆDÔØ ˆÔð 	×Ñ˜(Ô#Ø×Ñ˜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)r/   r9   s     r6   r.   zSecondaryAxis.set_alignment9   s¬   € ô 	×Ñ˜4×+Ñ+°5Õ9Ø�D×$Ñ$ QÑ'Ò'Ø#×/Ñ/±°"°Ñ5ˆDÔØ�‰�D×$Ñ$ QÑ'Ñ(×4Ñ4°TÔ:Ø�‰�D×$Ñ$ QÑ'Ñ(×4Ñ4°UÔ;Ø�
‰
×%Ñ% eÔ,Ø�
‰
×%Ñ% eÕ,r7   c                 óî  — 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}n| j
                  dddg}| j                  t        || j                  j                  «      «       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).
        )r1   )r   r   r   g        zlocation must be r   z, r   z, or a float, not r   g»½×Ùß|Û=N)Ú
isinstanceÚstrr   r   r!   r-   ÚnumbersÚRealÚ
ValueErrorÚ_locr   Úset_axes_locatorr   r   Ú	transAxes)r/   r1   Úboundss      r6   r%   zSecondaryAxis.set_locationL   sî   € ô  �h¤Ô$Ü×Ñ˜t×/Ñ/¸(ÕCØ&Ð*:Ñ:™ÀˆD�IÜ˜¤'§,¡,Ô/Ø ˆD�IäØ# D×$4Ñ$4°QÑ$7Ð#:¸"Ø×#Ñ# AÑ&Ð)Ð);¸H¸<ðIóJð Jð ˆŒ	à×Ñ Ò#ð ˜Ÿ™ B¨Ð.‰Fà—i‘i  E¨1Ð-ˆFð 	×ÑÜ% f¨d¯l©l×.DÑ.DÓEõ	Gr7   c                 óD   •— | j                  «        t        ‰| �	  |«       y ©N)Ú	_set_limsr   Úapply_aspect)r/   Úpositionr5   s     €r6   rH   zSecondaryAxis.apply_aspectv   s   ø€ à�‰ÔÜ‰Ñ˜XÕ&r7   F)Úminorc                ób   —  | j                   j                  ||fd|i|¤Ž}d| _        d| _        |S )NrJ   T)r    Ú	set_ticksÚstaler   )r/   ÚticksÚlabelsrJ   r3   Úrets         r6   rL   zSecondaryAxis.set_ticks{   s7   € à"ˆd�j‰j×"Ñ" 5¨&ÑH¸ÐHÀÑHˆØˆŒ
ØˆŒØˆ
r7   c                 óÚ   — t        |t        «      r2t        |«      dk(  r$t        |d   «      rt        |d   «      r|| _        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   Nc                 ó   — | S rF   © ©r   s    r6   ú<lambda>z-SecondaryAxis.set_functions.<locals>.<lambda>™   s   € ¨€ r7   c                 ó   — | S rF   rT   rU   s    r6   rV   z-SecondaryAxis.set_functions.<locals>.<lambda>™   s   € °a€ r7   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)r<   ÚtupleÚlenÚcallabler   r@   Ú
_set_scale)r/   r2   s     r6   r&   zSecondaryAxis.set_functions‚   sl   € ô" �y¤%Ô(¬S°«^¸qÒ-@Ü˜ 1™Ô&¬8°I¸a±LÔ+Að (ˆD�OØÐÙ*©KÐ8ˆD�Oäð @ó Að Að 	�‰Õr7   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)rG   r[   r   Údraw)r/   Úrendererr5   s     €r6   r]   zSecondaryAxis.draw¡   s%   ø€ ð 	�‰Ôà�‰ÔÜ‰‰�XÕr7   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   )r2   )r   r   r   Ú	get_scaleÚ
set_xscaler#   Ú
set_yscaler$   r   r    Úget_ticklocsr   r'   r(   ÚFixedLocator)r/   ÚpscaleÚ	set_scalerN   s       r6   r[   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ð #ˆÕr7   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)r/   ÚlimsÚset_limÚorderÚneworders        r6   rG   zSecondaryAxis._set_limsÌ   s¥   € ð
 ×Ñ Ò#Ø—<‘<×(Ñ(Ó*ˆDØ—m‘m‰Gà—<‘<×(Ñ(Ó*ˆDØ—m‘mˆGØ�Q‘˜$˜q™'Ñ!ˆØ!ˆt�‰˜qÑ!¤"§(¡(¨4£.Ó1ˆØ˜‘7˜T !™WÑ$ˆØ�uÒà™˜"˜‘:ˆDÙ��r7   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)r/   Úargsr3   s      r6   Ú
set_aspectzSecondaryAxis.set_aspectß   s   € ô
 	×ÑÐFÕGr7   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 : color
        )ÚcolorsN)Ú	_axis_mapr   Úset_tick_paramsr+   ÚvaluesÚaxisÚ	set_colorÚlabel)r/   Úcolorr~   Úspines       r6   r   zSecondaryAxis.set_coloræ   sq   € ð �~‰~˜d×/Ñ/Ñ0ˆØ×Ñ EÐÔ*Ø—[‘[×'Ñ'Ó)ò 	'ˆEØ�z‰z˜TÒ!Ø—‘ Õ&ð	'ð 	�
‰
×Ñ˜UÕ#r7   rF   )Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r.   r%   rH   r   Úcopyr   rL   r&   r]   r[   rG   rx   r   Ú__classcell__)r5   s   @r6   r	   r	      sh   ø„ ñô'0òR-ò&(GõT'ð
 €Z‡_�_�T—^‘^Ó$ð°Uó ó %ðòô>ò#ò:ò&Hö$r7   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.

Returns
-------
ax : axes._secondary_axes.SecondaryAxis

Other Parameters
----------------
**kwargs : `~matplotlib.axes.Axes` properties.
    Other miscellaneous axes parameters.
)Ú_secax_docstring)r>   Únumpyro   Ú
matplotlibr   r   Úmatplotlib.tickerÚtickerr(   Úmatplotlib.axes._baser   r   Úmatplotlib.axisr   r	   r‰   ÚinterpdÚupdaterT   r7   r6   ú<module>r’      sI   ðÛ ã ç 'Ý #ß FÝ  ôh$�Iô h$ðV$Ð ðJ × Ñ × Ñ Ð+;Ð Õ <r7   