Ë
    íÍ:j,  ã                   ój   — d Z ddlmZmZmZ ddlmZmZmZ ddl	m
Z
 dZ G d„ dej                  «      Zy	)
z¢
The inset module defines the InsetIndicator class, which draws the rectangle and
connectors required for `.Axes.indicate_inset` and `.Axes.indicate_inset_zoom`.
é   )Ú_apiÚartistÚ
transformsé    )ÚConnectionPatchÚ	PathPatchÚ	Rectangle)ÚPath)ÚalphaÚ	edgecolorÚ	linestyleÚ	linewidthc                   óþ   ‡ — e Zd ZdZdZdˆ fd„	Zd„ Zej                  j                  j                  d„ «       Z	d„ Zd„ Zd„ Zd	„ Zd
„ Zd„ Zd„ Zed„ «       Zed„ «       Zd„ Z ej.                  dd¬«      d„ «       Zˆ xZS )ÚInsetIndicatora  
    An artist to highlight an area of interest.

    An inset indicator is a rectangle on the plot at the position indicated by
    *bounds* that optionally has lines that connect the rectangle to an inset
    Axes (`.Axes.inset_axes`).

    .. versionadded:: 3.10
    gö(\�Âõ@c           	      ón  •— |€|€t        d«      ‚|| _        |€d| _        | j                  «       }nd| _        |\  }}}}t	        ||f||fddi|¤Ž| _        g | _        t        ‰
| �!  «        | j                  |«       t        D ]0  }	t        | d|	› �t        j                  | j
                  |	«      «       Œ2 y)aN  
        Parameters
        ----------
        bounds : [x0, y0, width, height], optional
            Lower-left corner of rectangle to be marked, and its width
            and height.  If not set, the bounds will be calculated from the
            data limits of inset_ax, which must be supplied.

        inset_ax : `~.axes.Axes`, optional
            An optional inset Axes to draw connecting lines to.  Two lines are
            drawn connecting the indicator box to the inset Axes on corners
            chosen so as to not overlap with the indicator box.

        zorder : float, default: 4.99
            Drawing order of the rectangle and connector lines.  The default,
            4.99, is just below the default level of inset Axes.

        **kwargs
            Other keyword arguments are passed on to the `.Rectangle` patch.
        Nz3At least one of bounds or inset_ax must be suppliedTFÚclip_onÚ_)Ú
ValueErrorÚ	_inset_axÚ_auto_update_boundsÚ_bounds_from_inset_axr	   Ú
_rectangleÚ_connectorsÚsuperÚ__init__Ú
set_zorderÚ_shared_propertiesÚsetattrr   Úgetp)ÚselfÚboundsÚinset_axÚzorderÚkwargsÚxÚyÚwidthÚheightÚpropÚ	__class__s             €úe/home/mcse/projects/srt_converter/srt-converter-venv/lib/python3.12/site-packages/matplotlib/inset.pyr   zInsetIndicator.__init__   sÆ   ø€ ð* ˆ>˜hÐ.ÜÐRÓSÐSà!ˆŒàˆ>à'+ˆDÔ$Ø×/Ñ/Ó1‰Fà',ˆDÔ$à$Ñˆˆ1ˆe�Vä# Q¨ F¨E°6ÑSÀ5ÐSÈFÑSˆŒð ˆÔä‰ÑÔØ�‰˜Ôô 'ò 	JˆDÜ�D˜A˜d˜V˜*¤f§k¡k°$·/±/À4Ó&HÕIñ	Jó    c                 ó€   — t        | d|› �|«       t        j                  | j                  g| j                  ¢||«       y)z`
        Helper function to set the same style property on the artist and its children.
        r   N)r   r   Úsetpr   r   )r    r)   Úvals      r+   Ú_shared_setterzInsetIndicator._shared_setterJ   s8   € ô 	�˜˜$˜�j #Ô&ä�‰�T—_‘_Ð8 t×'7Ñ'7Ð8¸$ÀÕDr,   c                 óz   — || j                   _        t        j                  j                  j	                  | |«       y ©N)Ú	rectangleÚaxesr   ÚArtistÚfset)r    Únew_axess     r+   r4   zInsetIndicator.axesR   s*   € ð 'ˆ�‰ÔÜ�‰×Ñ×Ñ  hÕ/r,   c                 ó(   — | j                  d|«       y )Nr   ©r0   )r    r   s     r+   Ú	set_alphazInsetIndicator.set_alphaY   s   € à×Ñ˜G UÕ+r,   c                 ó(   — | j                  d|«       y)z™
        Set the edge color of the rectangle and the connectors.

        Parameters
        ----------
        color : :mpltype:`color` or None
        r   Nr9   )r    Úcolors     r+   Úset_edgecolorzInsetIndicator.set_edgecolor]   s   € ð 	×Ñ˜K¨Õ/r,   c                 óL   — | j                  d|«       | j                  d|«       y)z¹
        Set the edgecolor of the rectangle and the connectors, and the
        facecolor for the rectangle.

        Parameters
        ----------
        c : :mpltype:`color`
        r   Ú	facecolorNr9   )r    Úcs     r+   Ú	set_colorzInsetIndicator.set_colorg   s$   € ð 	×Ñ˜K¨Ô+Ø×Ñ˜K¨Õ+r,   c                 ó(   — | j                  d|«       y)z“
        Set the linewidth in points of the rectangle and the connectors.

        Parameters
        ----------
        w : float or None
        r   Nr9   )r    Úws     r+   Úset_linewidthzInsetIndicator.set_linewidths   s   € ð 	×Ñ˜K¨Õ+r,   c                 ó(   — | j                  d|«       y)a  
        Set the linestyle of the rectangle and the connectors.

        Parameters
        ----------
        ls : {'-', '--', '-.', ':', '', ...} or (offset, on-off-seq)
            Possible values:

            - A string:

              =======================================================  ================
              linestyle                                                description
              =======================================================  ================
              ``'-'`` or ``'solid'``                                   solid line
              ``'--'`` or ``'dashed'``                                 dashed line
              ``'-.'`` or ``'dashdot'``                                dash-dotted line
              ``':'`` or ``'dotted'``                                  dotted line
              ``''`` or ``'none'`` (discouraged: ``'None'``, ``' '``)  draw nothing
              =======================================================  ================

            - A tuple describing the start position and lengths of dashes and spaces:

                  (offset, onoffseq)

              where

              - *offset* is a float specifying the offset (in points); i.e. how much
                is the dash pattern shifted.
              - *onoffseq* is a sequence of on and off ink in points. There can be
                arbitrary many pairs of on and off values.

              Example: The tuple ``(0, (10, 5, 1, 5))`` means that the pattern starts
              at the beginning of the line. It draws a 10 point long dash,
              then a 5 point long space, then a 1 point long dash, followed by a 5 point
              long space, and then the pattern repeats.

            For examples see :doc:`/gallery/lines_bars_and_markers/linestyles`.
        r   Nr9   )r    Úlss     r+   Úset_linestylezInsetIndicator.set_linestyle}   s   € ðN 	×Ñ˜K¨Õ,r,   c                 ó¦   — | j                   j                  «       }| j                   j                  «       }|d   |d   |d   |d   z
  |d   |d   z
  fS )Nr   r   )r   Úget_xlimÚget_ylim)r    ÚxlimÚylims      r+   r   z$InsetIndicator._bounds_from_inset_ax¦   sW   € Ø�~‰~×&Ñ&Ó(ˆØ�~‰~×&Ñ&Ó(ˆØ�Q‘˜˜a™ $ q¡'¨D°©GÑ"3°T¸!±W¸tÀA¹wÑ5FÐGÐGr,   c                 ód  — | j                   j                  «       \  }}| j                   j                  «       }| j                   j                  «       }| j                  xs d gdz  }t        g d¢|«      D �]?  \  }}|\  }}	| j                  j                  j                  «       rd|z
  }| j                  j                  j                  «       rd|	z
  }	|||z  z   ||	|z  z   f}
|€ˆt        || j                  j                  |
| j                  j                  «       d| j                  | j!                  «       | j"                  | j$                  ¬«	      }| j                  j'                  |«       Œø||_        |
|_        | j                  j                  |_        | j                  j                  «       |_        �ŒB �€w| j                  j1                  «       }|j3                  | j5                  d¬«      j6                  «      }t8        j:                  j=                  ||||«      j3                  | j                   j?                  «       «      }|j@                  |j@                  k  }|jB                  |jB                  k  }|jD                  |jD                  k  }|jF                  |jF                  k  }| j                  d   jI                  ||z  «       | j                  d   jI                  ||k(  «       | j                  d	   jI                  ||k(  «       | j                  d
   jI                  ||z  «       y y )Né   ))r   r   )r   r   )r   r   )r   r   r   ú-)	ÚxyAÚcoordsAÚxyBÚcoordsBÚ
arrowstyler   r   r   r   F)Úrootr   é   é   )%r   Úget_xyÚ	get_widthÚ
get_heightr   Úzipr4   ÚxaxisÚget_invertedÚyaxisr   r   Ú	transAxesr3   Úget_data_transformÚ
_edgecolorÚ	get_alphaÚ
_linestyleÚ
_linewidthÚappendÚxy1Úxy2Úcoords1Úcoords2Úget_positionÚtransformedÚ
get_figureÚtransSubfigurer   ÚBboxÚfrom_boundsÚget_transformÚx0Úx1Úy0Úy1Úset_visible)r    r%   r&   r'   r(   Úexisting_connectorsÚxy_inset_axÚexistingÚexÚeyÚxy_dataÚpÚposÚbboxinsÚrectbboxrq   rr   rs   rt   s                      r+   Ú_update_connectorsz!InsetIndicator._update_connectors«   s¥  € Ø—‘×'Ñ'Ó)‰ˆˆAØ—‘×)Ñ)Ó+ˆØ—‘×+Ñ+Ó-ˆà"×.Ñ.Ò<°4°&¸1±*Ðô &)Ò)IØ)<ó&>ó 	GÑ!ˆK˜ð
 !‰FˆB�Ø�y‰y�‰×+Ñ+Ô-Ø˜‘V�Ø�y‰y�‰×+Ñ+Ô-Ø˜‘V�Ø˜"˜u™*‘n a¨"¨v©+¡oÐ5ˆGØÐô $Ø#¨T¯^©^×-EÑ-EØ¨¯©×)JÑ)JÓ)LØ"Ø"Ÿo™o°T·^±^Ó5EØ"Ÿo™o¸¿¹ôJ�ð × Ñ ×'Ñ'¨Õ*ð  +�”Ø&�”Ø#'§>¡>×#;Ñ#;�Ô Ø#'§>¡>×#DÑ#DÓ#F�Ö ð7	Gð: Ñà—.‘.×-Ñ-Ó/ˆCØ—o‘o d§o¡o¸5 oÓ&A×&PÑ&PÓQˆGÜ!—‘×2Ñ2°1°a¸ÀÓG×SÑSØ—‘×-Ñ-Ó/ó1ˆHà—‘˜wŸz™zÑ)ˆBØ—‘˜wŸz™zÑ)ˆBØ—‘˜wŸz™zÑ)ˆBØ—‘˜wŸz™zÑ)ˆBØ×Ñ˜QÑ×+Ñ+¨B°©GÔ4Ø×Ñ˜QÑ×+Ñ+¨B°"©HÔ5Ø×Ñ˜QÑ×+Ñ+¨B°"©HÔ5Ø×Ñ˜QÑ×+Ñ+¨B°©GÕ4ð r,   c                 ó   — | j                   S )z"`.Rectangle`: the indicator frame.)r   ©r    s    r+   r3   zInsetIndicator.rectangleß   s   € ð �‰Ðr,   c                 óÐ   — | j                   €y| j                  r)| j                  j                  | j	                  «       «       | j                  «        t        | j                  «      S )ai  
        4-tuple of `.patches.ConnectionPatch` or None
            The four connector lines connecting to (lower_left, upper_left,
            lower_right upper_right) corners of *inset_ax*. Two lines are
            set with visibility to *False*,  but the user can set the
            visibility to True if the automatic choice is not deemed correct.
        N)r   r   r   Ú
set_boundsr   r€   Útupler   r‚   s    r+   Ú
connectorszInsetIndicator.connectorsä   sR   € ð �>‰>Ð!Øà×#Ò#Ø�O‰O×&Ñ& t×'AÑ'AÓ'CÔDØ×ÑÔ!Ü�T×%Ñ%Ó&Ð&r,   c                 óà  — g }| j                   xs g D ]€  }|j                  «       sŒd}t        D ]N  }t        j                  | j
                  |«      t        j                  ||«      k7  sŒ;|j                  |«       d} n |rŒp|j                  |«       Œ‚ |r·| j
                  g|z   }|D �cg c]/  }|j                  «       j                  |j                  «       «      ‘Œ1 }}t        j                  |Ž }	t        |	«      }
|
j                  | j
                  «       |
j                  t!        j"                  «       «       |
j                  |«       y | j
                  j                  |«       y c c}w )NFT)r†   Úget_visibler   r   r   r   Údrawre   rp   Útransform_pathÚget_pathr
   Úmake_compound_pathr   Úupdate_fromÚset_transformr   ÚIdentityTransform)r    ÚrendererÚconn_same_styleÚconnÚdrawnÚsÚartistsÚaÚpathsÚpathr|   s              r+   r‰   zInsetIndicator.drawõ   s6  € àˆð —O‘OÒ) rò 	1ˆDØ×ÑÕ!Ø�Ü+ò �AÜ—{‘{ 4§?¡?°AÓ6¼&¿+¹+ÀdÈAÓ:NÓNàŸ	™	 (Ô+Ø $˜Ùðò à#×*Ñ*¨4Õ0ð	1ñ ð —‘Ð'¨/Ñ9ˆGØMTÖUÈ�Q—_‘_Ó&×5Ñ5°a·j±j³lÕCÐUˆEÐUÜ×*Ñ*¨EÐ2ˆDô ˜$“ˆAØ�M‰M˜$Ÿ/™/Ô*Ø�O‰OœJ×8Ñ8Ó:Ô;Ø�F‰F�8Ôàð 	�‰×Ñ˜XÕ&ùò Vs   Â,4E+z3.10zÞSince Matplotlib 3.10 indicate_inset_[zoom] returns a single InsetIndicator artist with a rectangle property and a connectors property.  From 3.12 it will no longer be possible to unpack the return value into two elements.)Úmessagec                 ó8   — | j                   | j                  g|   S r2   )r   r†   )r    Úkeys     r+   Ú__getitem__zInsetIndicator.__getitem__  s   € ð —‘ §¡Ð1°#Ñ6Ð6r,   )NNN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r#   r   r0   r   r5   r4   Úsetterr:   r=   rA   rD   rG   r   r€   Úpropertyr3   r†   r‰   r   Ú
deprecatedrœ   Ú__classcell__)r*   s   @r+   r   r      s»   ø„ ñð €Fõ.Jò`Eð ‡]�]×Ñ×Ññ0ó ð0ò,ò0ò
,ò,ò'-òRHò
25ðh ñó ðð ñ'ó ð'ò $'ðL €T‡_�_Øð3ô5ñ7ó5ô7r,   r   N)r    Ú r   r   r   Úmatplotlib.patchesr   r   r	   Úmatplotlib.pathr
   r   r5   r   © r,   r+   ú<module>r©      s6   ðñ÷
 'Ñ &ß DÑ DÝ  ð FÐ ôT7�V—]‘]õ T7r,   