
    h$                         S SK JrJr  S SKJr  S SKJr  S SKJ	r	  SSK
Jr   " S S5      r\R                  " \S5      r\" \5      r " S	 S
5      r\R                  " \SS5      =rr\" \5      =rr\SS.S jr\rg)    )_apicbookN)Bbox   )Axesc                   j   ^  \ rS rSrSSS.U 4S jjjrU 4S jrU 4S jrU 4S jrS rS	 r	S
 r
SrU =r$ )ParasiteAxesBase   N)viewlim_modec                   > Xl         X l        U R                  U5        SUS'   [        TU ]  " UR                  SS9UR                  40 UD6  g )NFframeon)root)_parent_axestransAuxset_viewlim_modesuper__init__
get_figure	_position)selfparent_axesaux_transformr   kwargs	__class__s        W/var/www/html/env/lib/python3.13/site-packages/mpl_toolkits/axes_grid1/parasite_axes.pyr   ParasiteAxesBase.__init__
   sT    '%l+!y//U/;$..	:28	:    c                 ^  > [         TU ]  5         [        R                  " U R	                  5       SS9  U R
                  R                  U l        U R
                  R                  R                  SU R                  5        U R
                  R                  R                  SU R                  5        g )NF)visiblexlim_changedylim_changed)
r   clearmartistsetpget_childrenr   
_get_lines	callbacks_connect_picklable
_sync_limsr   r   s    r   r"   ParasiteAxesBase.clear   s|    T&&(%8++66##66DOO	-##66DOO	-r   c                    > [         TU ]  U5        U R                  5        HL  n[        UR                  S5      (       d  M   XR                  R
                  ;   d  M;  UR                  U5        MN     g )N	parasites)r   pickr%   hasattrinaxesr-   r   
mouseeventar   s      r   r.   ParasiteAxesBase.pick   sW     	Z  ""$A
));77 1 1 ; ;;z" %r   c                   > U R                   b  U R                  R                  U l        U R                   U R                  R                  -   U l        [        R
                  " U R                  U R                  5      U l        [        R
                  " U R                  U R                  5      U l        g [        TU ]%  5         g N)
r   r   	transAxes	transDatamtransformsblended_transform_factory_xaxis_transform_yaxis_transformr   _set_lim_and_transformsr*   s    r   r=   (ParasiteAxesBase._set_lim_and_transforms*   s    ==$!..88DN!]]T->->-H-HHDN$/$I$I%0D!$/$I$I%0D! G+-r   c                 >    [         R                  " / SQUS9  Xl        g )NNequal	transformmode)r   check_in_list_viewlim_mode)r   rD   s     r   r   !ParasiteAxesBase.set_viewlim_mode5   s    7dC!r   c                     U R                   $ r6   )rF   )r   s    r   get_viewlim_mode!ParasiteAxesBase.get_viewlim_mode9   s    !!!r   c                 d   UR                   R                  5       nU R                  5       nUc  g US:X  a  U R                   R                  U5        g US:X  aC  U R                   R                  UR	                  U R
                  R                  5       5      5        g [        R                  " / SQUS9  g )NrA   rB   r@   rC   )	viewLimfrozenrI   settransformedr   invertedr   rE   )r   parentviewlimrD   s       r   r)   ParasiteAxesBase._sync_lims<   s    ..'')$$&<W_LLW%[ LLW001G1G1IJK;$Gr   )r&   r   rF   r;   r<   r   r7   r8   r6   )__name__
__module____qualname____firstlineno__r   r"   r.   r=   r   rI   r)   __static_attributes____classcell__r   s   @r   r	   r	      s:    :!%: :-
#	.""
H 
Hr   r	   z
{}Parasitec                      ^  \ rS rSrU 4S jr SS jrU 4S jrU 4S jrU 4S jrSS jr	SS	 jr
SS
 jrS rS rSSSS.U 4S jjjrSrU =r$ )HostAxesBaseP   c                 4   > / U l         [        TU ]  " U0 UD6  g r6   )r-   r   r   )r   argsr   r   s      r   r   HostAxesBase.__init__Q   s    $)&)r   Nc                     Uc  U R                   n[        U5      nU" X4SU0UD6nU R                  R                  U5        U R                  R                  Ul        U$ )a  
Add a parasite axes to this host.

Despite this method's name, this should actually be thought of as an
``add_parasite_axes`` method.

.. versionchanged:: 3.7
   Defaults to same base axes class as host axes.

Parameters
----------
tr : `~matplotlib.transforms.Transform` or None, default: None
    If a `.Transform`, the following relation will hold:
    ``parasite.transData = tr + host.transData``.
    If None, the parasite's and the host's ``transData`` are unrelated.
viewlim_mode : {"equal", "transform", None}, default: "equal"
    How the parasite's view limits are set: directly equal to the
    parent axes ("equal"), equal after application of *tr*
    ("transform"), or independently (None).
axes_class : subclass type of `~matplotlib.axes.Axes`, optional
    The `~.axes.Axes` subclass that is instantiated.  If None, the base
    class of the host axes is used.
**kwargs
    Other parameters are forwarded to the parasite axes constructor.
r   )_base_axes_classparasite_axes_class_factoryr-   appendremove_remove_method)r   trr   
axes_classr   parasite_axes_classax2s          r   get_aux_axesHostAxesBase.get_aux_axesU   sh    6 ..J9*E!;#/;39; 	c"!^^22
r   c                   > [        U R                  5      nU R                  5       nU(       a*  U" X5      nU R                  USS9  U R	                  U5        OU R	                  5         U R                  5       nU R                   H=  nUR	                  U5        U R                  R                  UR                  5       5        M?     [        TU ])  U5        U R                  US 2	 g )Nactive)which)len	_childrenget_axes_locatorset_positionapply_aspectget_positionr-   extendr%   r   draw)r   rendererorig_children_lenlocatorposrectaxr   s          r   rw   HostAxesBase.draw{   s    /'')$)Cc2c"  "..BOOD!NN!!"//"34 ! 	XNN,-.r   c                 h   > [         TU ]  5         U R                   H  nUR                  5         M     g r6   )r   r"   r-   )r   r}   r   s     r   r"   HostAxesBase.clear   s#    ..BHHJ !r   c                 l   > [         TU ]  U5        U R                   H  nUR                  U5        M     g r6   )r   r.   r-   r1   s      r   r.   HostAxesBase.pick   s+    Z  AFF:  r   c                     U R                  XS9nU R                  S   R                  S5        UR                  S   R                  S5        UR                  S   R                  S5        U$ )z
Create a twin of Axes with a shared x-axis but independent y-axis.

The y-axis of self will have ticks on the left and the returned axes
will have ticks on the right.
)sharexrightFT)lefttopbottom_add_twin_axesaxisset_visibler   rh   r}   s      r   twinxHostAxesBase.twinx   sb        9		'&&u-
$$T*
'(44U;	r   c                     U R                  XS9nU R                  S   R                  S5        UR                  S   R                  S5        UR                  S   R                  S5        U$ )z
Create a twin of Axes with a shared y-axis but independent x-axis.

The x-axis of self will have ticks on the bottom and the returned axes
will have ticks on the top.
)shareyr   FT)r   r   r   r   r   s      r   twinyHostAxesBase.twiny   sa        9		%$$U+
""4(
)*66u=	r   c                 
   Uc  [         R                  " 5       nU R                  X!SS9nU R                  S   R	                  S5        UR                  S   R	                  S5        UR                  S   R	                  S5        U$ )z
Create a twin of Axes with no shared axis.

While self will have ticks on the left and bottom axis, the returned
axes will have ticks on the top and right axis.
rB   )r   r   )r   r   FT)r   r   )r9   IdentityTransformr   r   r   )r   	aux_transrh   r}   s       r   twinHostAxesBase.twin   s~     #557I  k ! K		.!--e4
++D1
 !--e4	r   c                     Uc  U R                   n[        U5      " U 40 UD6nU R                  R                  U5        U R                  Ul        U$ )za
Helper for `.twinx`/`.twiny`/`.twin`.

*kwargs* are forwarded to the parasite axes constructor.
)rb   rc   r-   rd   _remove_any_twinrf   )r   rh   r   r}   s       r   r   HostAxesBase._add_twin_axes   sN     ..J(4TDVDb! 11	r   c                 d   U R                   R                  U5        SS/nUR                  (       a  UR                  S5        UR                  (       a  UR                  S5        U R                  [        U5         R                  S5        U R                  [        U5         R                  SSS9  g )Nr   r   TF)
ticklabelslabel)r-   re   _sharex_shareyr   tupler   toggle)r   r}   restores      r   r   HostAxesBase._remove_any_twin   s    b!'"::NN5!::NN7#		%.!--d3		%.!((E(Gr   Tcall_axes_locatorbbox_extra_artistsc          	        > / U R                    Vs/ s H  nUR                  XS9PM     snQ[        TU ]  UUUS9Pn[        R                  " U Vs/ s H&  ofR
                  S:w  d  UR                  S:w  d  M$  UPM(     sn5      $ s  snf s  snf )N)r   r   r   )r-   get_tightbboxr   r   unionwidthheight)r   rx   r   r   r}   bbsbr   s          r   r   HostAxesBase.get_tightbbox   s    J(&" xM&(J G!(4E5G " IJ zzcKcWW\QXX]1cKLL(
 Ls   B#B
8B
)r-   )NrA   Nr6   )NN)rT   rU   rV   rW   r   rk   rw   r"   r.   r   r   r   r   r   r   rX   rY   rZ   s   @r   r\   r\   P   sT    *
 =A$L/&
 HM)-M Mr   r\   z
{}HostAxesrb   )rh   figurec                     SSK Jn  [        U 5      nUc  UR                  5       nU" U/UQ70 UD6nUR	                  U5        U$ )a,  
Create axes that can act as a hosts to parasitic axes.

Parameters
----------
figure : `~matplotlib.figure.Figure`
    Figure to which the axes will be added. Defaults to the current figure
    `.pyplot.gcf()`.

*args, **kwargs
    Will be passed on to the underlying `~.axes.Axes` object creation.
r   N)matplotlib.pyplotpyplothost_axes_class_factorygcfadd_axes)rh   r   r_   r   plthost_axes_classr}   s          r   	host_axesr      sF     $-j9O~		1$	1&	1B
OOBIr   )
matplotlibr   r   matplotlib.artistartistr#   matplotlib.transforms
transformsr9   r   mpl_axesr   r	   _make_class_factoryrc   ParasiteAxesr\   r   host_subplot_class_factoryHostAxesSubplotHostr   host_subplot r   r   <module>r      s    " # + & >H >HF $77l$ *40SM SMn 
lL:LMN 406 6; !%T , r   