
    h'                     j    S r SSKJrJrJr  SSKJrJrJr  SSK	J
r
  Sr " S S\R                  5      rg	)
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                      ^  \ rS rSrSrSrSU 4S jjrS rS rS r	S r
S	 rS
 rS rS r\S 5       r\S 5       rS r\R(                  " SSS9S 5       rSrU =r$ )InsetIndicator   z
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           	      p  > Uc  Uc  [        S5      eX l        Uc  SU l        U R                  5       nOSU l        Uu  pVpx[	        XV4Xx4SS0UD6U l        / U l        [        T
U ]!  5         U R                  U5        [         H2  n	[        U SU	 3[        R                  " U R
                  U	5      5        M4     g)a  
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             B/var/www/html/env/lib/python3.13/site-packages/matplotlib/inset.pyr   InsetIndicator.__init__   s    * >h.RSS!>'+D$//1F',D$$e#QFES5SFS  'DDAdV*fkk$//4&HI '    c                     [        U SU 3U5        [        R                  " U R                  /U R                  QX5        g)zP
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_setterInsetIndicator._shared_setterJ   s6     	$j#&T__8t'7'78$Dr.   c                 (    U R                  SU5        g )Nr   r2   )r!   r   s     r,   	set_alphaInsetIndicator.set_alphaR   s    GU+r.   c                 (    U R                  SU5        g)zq
Set the edge color of the rectangle and the connectors.

Parameters
----------
color : :mpltype:`color` or None
r   Nr5   )r!   colors     r,   set_edgecolorInsetIndicator.set_edgecolorV   s     	K/r.   c                 L    U R                  SU5        U R                  SU5        g)z
Set the edgecolor of the rectangle and the connectors, and the
facecolor for the rectangle.

Parameters
----------
c : :mpltype:`color`
r   	facecolorNr5   )r!   cs     r,   	set_colorInsetIndicator.set_color`   s$     	K+K+r.   c                 (    U R                  SU5        g)zk
Set the linewidth in points of the rectangle and the connectors.

Parameters
----------
w : float or None
r   Nr5   )r!   ws     r,   set_linewidthInsetIndicator.set_linewidthl   s     	K+r.   c                 (    U R                  SU5        g)aS  
Set the linestyle of the rectangle and the connectors.

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

Alternatively a dash tuple of the following form can be provided::

    (offset, onoffseq)

where ``onoffseq`` is an even length tuple of on and off ink in points.

Parameters
----------
ls : {'-', '--', '-.', ':', '', (offset, on-off-seq), ...}
    The line style.
r   Nr5   )r!   lss     r,   set_linestyleInsetIndicator.set_linestylev   s    2 	K,r.   c                     U R                   R                  5       nU R                   R                  5       nUS   US   US   US   -
  US   US   -
  4$ )Nr   r   )r   get_xlimget_ylim)r!   xlimylims      r,   r   $InsetIndicator._bounds_from_inset_ax   sW    ~~&&(~~&&(Qa$q'DG"3T!WtAw5FGGr.   c                 Z   U R                   R                  5       u  pU R                   R                  5       nU R                   R                  5       nU R                  =(       d    S /S-  n[        / SQU5       GH9  u  pgUu  pU R                  R                  R                  5       (       a  SU-
  nU R                  R                  R                  5       (       a  SU	-
  n	XU-  -   X)U-  -   4n
Uc  [        X`R                  R                  XR                  R                  SU R                  U R                  5       U R                   U R"                  S9	nU R                  R%                  U5        M  Xgl        Xl        U R                  R                  Ul        U R                  R                  Ul        GM<     WGcr  U R                  R/                  5       nUR1                  U R3                  SS9R4                  5      n[6        R8                  R;                  XX45      R1                  U R                   R=                  5       5      nUR>                  UR>                  :  nUR@                  UR@                  :  nURB                  URB                  :  nURD                  URD                  :  nU R                  S   RG                  UU-  5        U R                  S   RG                  UU:H  5        U R                  S	   RG                  UU:H  5        U R                  S
   RG                  UU-  5        g g )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   zipaxesxaxisget_invertedyaxisr   r   	transAxes	transData
_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rectbboxrt   ru   rv   rw   s                      r,   _update_connectors!InsetIndicator._update_connectors   s   '')))+++-"..<4&1* &))I)<&>!K
 !FByy++--Vyy++--Vu*nav+o5G $#^^-E-E)<)<""ooT^^5E"ooJ   ''*  +&#'>>#;#; #'99#6#6 7&>: ..--/Coodoo5o&A&P&PQG!221GSS--/1Hwzz)Bwzz)Bwzz)Bwzz)BQ++BG4Q++B"H5Q++B"H5Q++BG4 r.   c                     U R                   $ )z"`.Rectangle`: the indicator frame.)r   r!   s    r,   	rectangleInsetIndicator.rectangle   s     r.   c                     U R                   c  gU R                  (       a)  U R                  R                  U R	                  5       5        U R                  5         [        U R                  5      $ )a9  
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,   
connectorsInsetIndicator.connectors   sR     >>!##OO&&t'A'A'CD!T%%&&r.   c                     / nU R                   =(       d    /  H  nUR                  5       (       d  M  Sn[         HQ  n[        R                  " U R
                  U5      [        R                  " X55      :w  d  M>  UR                  U5        Sn  O   U(       a  M  UR                  U5        M     U(       a  U R
                  /U-   nU Vs/ s H/  owR                  5       R                  UR                  5       5      PM1     nn[        R                  " U6 n	[        U	5      n
U
R                  U R
                  5        U
R                  [         R"                  " 5       5        U
R                  U5        g U R
                  R                  U5        g s  snf )NFT)r   get_visibler   r   r    r   drawrh   rs   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   InsetIndicator.draw   s1    OO)r)D!!+A{{4??A6&++d:NN		(+ $ , u#**40 *  '/9GMTUW__&55ajjlCWEU**E2D $AMM$//*OOJ88:;FF8 	X& Vs   6Fz3.10zSince 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    U R                   U R                  /U   $ )N)r   r   )r!   keys     r,   __getitem__InsetIndicator.__getitem__  s     1#66r.   )r   r   r   r   )NNN)__name__
__module____qualname____firstlineno____doc__r$   r   r2   r6   r:   r?   rC   rG   r   r   propertyr   r   r   r   
deprecatedr   __static_attributes____classcell__)r+   s   @r,   r   r      s     F.J`E,0
,,-6H
25h   ' ' $'L 
__35757r.   r   N)r    r   r   r   matplotlib.patchesr   r   r	   matplotlib.pathr
   r   Artistr    r.   r,   <module>r      s6   
 ' & D D   F 7V]] 7r.   