
    ho.                         S SK r S SKrS SKJrJrJr  S SKJr	  S SK
JrJr  S SKJr  S SKJr   " S S\5      rSr\R&                  R)                  \S	9  g)
    N)_api
_docstring
transforms)	_AxesBase_TransformedBoundsLocator)Axis)	Transformc                      ^  \ rS rSrSrSU 4S jjrS rSS jrSU 4S jjr\	R                  " \R                  5      SSS.S	 jj5       rS
 rU 4S jrS rS rS rS rSrU =r$ )SecondaryAxis   z,
General class to hold a Secondary_X/Yaxis.
c                   > [         R                  " SS/US9  X@l        Xl        X l        SU l        U R                  R                  SS9nU R                  S:X  a8  [        T	U ]   " U/ SQ40 UD6  U R                  U l
        SS/U l        S	S
/U l        O7[        T	U ]   " U/ SQ40 UD6  U R                  U l
        S
S	/U l        SS/U l        SU l        U R                  X55        U R!                  U5        U R                  S:X  a  U R                  OU R                  nUR#                  [$        R&                  " 5       5        UR)                  S5        U R*                  U R                     R-                  S5        U R*                  U R                     R-                  S5        U R.                  S:  a  U R                  SSS2   U l        U R1                  U R                  S   5        g)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
            Q/var/www/html/env/lib/python3.13/site-packages/matplotlib/axes/_secondary_axes.pyr"   SecondaryAxis.__init__   s    	C:;?#'ll%%5%1#GS"4??DJ %x0D"('!2DGS"4??DJ '0D"'!2D  	(.9% #'"3"3s":DJJ

	##G$7$7$9:$$V,D&&'33E:D$$%11$799s?#//"5D4++A./    c                    [         R                  " U R                  US9  XR                  S   :X  a  U R                  SSS2   U l        U R                  U R                  S      R	                  S5        U R                  U R                  S      R	                  S5        U R
                  R                  U5        U R
                  R                  U5        g)z
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/   r0   r$   r.   set_label_position)r3   r@   s     r<   r2   SecondaryAxis.set_alignment<   s     	4++59$$Q''#//"5DD$$Q'(44T:D$$Q'(44U;

%%e,

%%e,r>   c                    [         R                  " [        R                  S4US9  [	        U[
        5      (       a/  [         R                  " U R                  US9  US;   a  SOSU l        OW[	        U[        R                  5      (       a  Xl        O1[        SU R                  S   < S	U R                  S
   < SU< 35      eXl        U R                  S:X  a?  SU R                  SS/nUb+  [        R                  " U R                  R                   U5      nO=U R                  SSS
/nUb*  [        R                  " X R                  R                   5      nUc  U R                  R                   nU R#                  [%        X25      5        g)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)r7   )r5   )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%   r1   numbersReal
ValueError_locr   blended_transform_factoryr   	transAxesset_axes_locatorr   )r3   r5   r7   boundss       r<   r)   SecondaryAxis.set_locationO   sb   , 	z33T:iP h$$t//(C&*::DI',,// I#D$4$4Q$7#:"##A&));H<IJ J 	# B.F
 $&@@LL**I7	 iiE1-F$&@@||557	 ..I 	7JKr>   c                 D   > U R                  5         [        TU ]	  U5        g N)	_set_limsr!   apply_aspect)r3   positionr;   s     r<   rS   SecondaryAxis.apply_aspect   s    X&r>   F)minorc                `    U R                   R                  " X4SU0UD6nSU l        SU l        U$ )NrV   T)r$   	set_ticksstaler   )r3   tickslabelsrV   r8   rets         r<   rX   SecondaryAxis.set_ticks   s3    jj""5HHH

r>   c                 X  ^ [        T[        5      (       a=  [        T5      S:X  a.  [        TS   5      (       a  [        TS   5      (       a  TU l        OG[        T[
        5      (       a  TR                  U4S j4U l        OTc  S S 4U l        O[        S5      eU R                  5         g)	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   > TR                  5       R                  U 5      $ rQ   )invertedr7   )r   r6   s    r<   <lambda>-SecondaryAxis.set_functions.<locals>.<lambda>   s    9--/99!<r>   Nc                     U $ rQ    r   s    r<   rb   rc      s    r>   c                     U $ rQ   re   rf   s    r<   rb   rc      s    ar>   zfunctions 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)	rE   tuplelencallabler   r	   r7   rI   
_set_scale)r3   r6   s    `r<   r*   SecondaryAxis.set_functions   s    $ y%((S^q-@1&&8IaL+A+A (DO	9--$$<DO *K8DO @ A A 	r>   c                 d   > U R                  5         U R                  5         [        TU ]  U5        g)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)rR   rk   r!   draw)r3   rendererr;   s     r<   rn   SecondaryAxis.draw   s%     	Xr>   c                 &   U R                   S:X  a1  U R                  R                  R                  5       nU R                  nO0U R                  R
                  R                  5       nU R                  nXR                  :X  a  gU R                  (       a  U R                  R                  5       nU" US:X  a  SOSU R                  SSS2   S9  U R                  (       a/  U R                  R                  [        R                  " W5      5        Xl        g)z#
Check if parent has set its scale
r   Nlogfunctionlogfunctionr   )r6   )r   r   r#   	get_scale
set_xscaler'   
set_yscaler(   r   r$   get_ticklocsr   r+   r,   FixedLocator)r3   pscale	set_scalerZ   s       r<   rk   SecondaryAxis._set_scale   s    
 #\\''113FI\\''113FI&&&??JJ++-E 	6U?-
 OODbD1	3
 ??JJ(()=)=e)DE #r>   c                 f   U R                   S:X  a'  U R                  R                  5       nU R                  nO&U R                  R	                  5       nU R
                  nUS   US   :  nU R                  S   " [        R                  " U5      5      nUS   US   :  nXC:w  a  USSS2   nU" U5        g)zj
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)r3   limsset_limorderneworders        r<   rR   SecondaryAxis._set_lims   s    
 #<<((*DmmG<<((*DmmGQ$q'!q!"((4.17T!W$":Dr>   c                 0    [         R                  " S5        g)zR
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)r3   argsr8   s      r<   
set_aspectSecondaryAxis.set_aspect   s    
 	FGr>   c                    U R                   U R                     nUR                  US9  U R                  R	                  5        H%  nUR
                  UL d  M  UR                  U5        M'     UR                  R                  U5        g)zl
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)r3   colorr   spines       r<   r   SecondaryAxis.set_color  sl     ~~d//0E*[['')EzzT!& * 	

U#r>   )r$   r   rJ   r%   r   r&   r   r(   r1   r   rY   rQ   )__name__
__module____qualname____firstlineno____doc__r"   r2   r)   rS   r   copyr   rX   r*   rn   rk   rR   r   r   __static_attributes____classcell__)r;   s   @r<   r   r      sl    )0V-&>L@'
 __T^^$U  %#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

Other Parameters
----------------
**kwargs : `~matplotlib.axes.Axes` properties.
    Other miscellaneous Axes parameters.
)_secax_docstring)rG   numpyr   
matplotlibr   r   r   matplotlib.tickertickerr,   matplotlib.axes._baser   r   matplotlib.axisr   matplotlib.transformsr	   r   r   interpdregisterre   r>   r<   <module>r      sO      3 3 # F   +F$I F$R, Z     -=  >r>   