
    h	C                         S SK Jr  S SKJrJrJrJrJr  S SKJ	r	J
r
JrJr  S SKJr  / SQr " S S\5      r " S S	\5      r " S
 S\5      r " S S\5      rg)    )
transforms)AnchoredOffsetboxAuxTransformBoxDrawingAreaTextAreaVPacker)	Rectangle
ArrowStyleFancyArrowPatch	PathPatch)TextPath)AnchoredDrawingAreaAnchoredAuxTransformBoxAnchoredSizeBarAnchoredDirectionArrowsc                   .   ^  \ rS rSr SU 4S jjrSrU =r$ )r      c
           	         > [        XX45      U l        U R                  U l        [        TU ]  " U4XgU R                  SU	S.U
D6  g)ac  
An anchored container with a fixed size and fillable `.DrawingArea`.

Artists added to the *drawing_area* will have their coordinates
interpreted as pixels. Any transformations set on the artists will be
overridden.

Parameters
----------
width, height : float
    Width and height of the container, in pixels.
xdescent, ydescent : float
    Descent of the container in the x- and y- direction, in pixels.
loc : str
    Location of this artist.  Valid locations are
    'upper left', 'upper center', 'upper right',
    'center left', 'center', 'center right',
    'lower left', 'lower center', 'lower right'.
    For backward compatibility, numeric values are accepted as well.
    See the parameter *loc* of `.Legend` for details.
pad : float, default: 0.4
    Padding around the child objects, in fraction of the font size.
borderpad : float, default: 0.5
    Border padding, in fraction of the font size.
prop : `~matplotlib.font_manager.FontProperties`, optional
    Font property used as a reference for paddings.
frameon : bool, default: True
    If True, draw a box around this artist.
**kwargs
    Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
drawing_area : `~matplotlib.offsetbox.DrawingArea`
    A container for artists to display.

Examples
--------
To display blue and red circles of different sizes in the upper right
of an Axes *ax*:

>>> ada = AnchoredDrawingArea(20, 20, 0, 0,
...                           loc='upper right', frameon=False)
>>> ada.drawing_area.add_artist(Circle((10, 10), 10, fc="b"))
>>> ada.drawing_area.add_artist(Circle((30, 10), 5, fc="r"))
>>> ax.add_artist(ada)
Npad	borderpadchildpropframeon)r   dadrawing_areasuper__init__)selfwidthheightxdescentydescentlocr   r   r   r   kwargs	__class__s              Z/var/www/html/env/lib/python3.13/site-packages/mpl_toolkits/axes_grid1/anchored_artists.pyr   AnchoredDrawingArea.__init__   sK    d eX@ GG	
TWW4	
%	
    )r   r   皙?g      ?NT__name__
__module____qualname____firstlineno__r   __static_attributes____classcell__r&   s   @r'   r   r      s    AE8
 8
r)   r   c                   .   ^  \ rS rSr SU 4S jjrSrU =r$ )r   H   c           	      d   > [        U5      U l        [        TU ]  " U4X4U R                  XVS.UD6  g)a3  
An anchored container with transformed coordinates.

Artists added to the *drawing_area* are scaled according to the
coordinates of the transformation used. The dimensions of this artist
will scale to contain the artists added.

Parameters
----------
transform : `~matplotlib.transforms.Transform`
    The transformation object for the coordinate system in use, i.e.,
    :attr:`matplotlib.axes.Axes.transData`.
loc : str
    Location of this artist.  Valid locations are
    'upper left', 'upper center', 'upper right',
    'center left', 'center', 'center right',
    'lower left', 'lower center', 'lower right'.
    For backward compatibility, numeric values are accepted as well.
    See the parameter *loc* of `.Legend` for details.
pad : float, default: 0.4
    Padding around the child objects, in fraction of the font size.
borderpad : float, default: 0.5
    Border padding, in fraction of the font size.
prop : `~matplotlib.font_manager.FontProperties`, optional
    Font property used as a reference for paddings.
frameon : bool, default: True
    If True, draw a box around this artist.
**kwargs
    Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
drawing_area : `~matplotlib.offsetbox.AuxTransformBox`
    A container for artists to display.

Examples
--------
To display an ellipse in the upper left, with a width of 0.1 and
height of 0.4 in data coordinates:

>>> box = AnchoredAuxTransformBox(ax.transData, loc='upper left')
>>> el = Ellipse((0, 0), width=0.1, height=0.4, angle=30)
>>> box.drawing_area.add_artist(el)
>>> ax.add_artist(box)
r   N)r   r   r   r   )	r   	transformr$   r   r   r   r   r%   r&   s	           r'   r    AnchoredAuxTransformBox.__init__I   s<    ^ ,I6 	###00t	#!	#r)   )r   r*   r,   r3   s   @r'   r   r   H   s    <@3# 3#r)   r   c                   2   ^  \ rS rSr   SU 4S jjrSrU =r$ )r      c                   > Uc  U	S:  n[        U5      U l        U R                  R                  [        SX)XU
S95        Uc  SU;   a  UR	                  S5      nUc  SU
0nOXS.n[        X?S9U l        U(       a  U R                  U R                  /nOU R                  U R                  /n[        US	SUS
9U l        [        TU ](  " U4XVU R                  XS.UD6  g)a'  
Draw a horizontal scale bar with a center-aligned label underneath.

Parameters
----------
transform : `~matplotlib.transforms.Transform`
    The transformation object for the coordinate system in use, i.e.,
    :attr:`matplotlib.axes.Axes.transData`.
size : float
    Horizontal length of the size bar, given in coordinates of
    *transform*.
label : str
    Label to display.
loc : str
    Location of the size bar.  Valid locations are
    'upper left', 'upper center', 'upper right',
    'center left', 'center', 'center right',
    'lower left', 'lower center', 'lower right'.
    For backward compatibility, numeric values are accepted as well.
    See the parameter *loc* of `.Legend` for details.
pad : float, default: 0.1
    Padding around the label and size bar, in fraction of the font
    size.
borderpad : float, default: 0.1
    Border padding, in fraction of the font size.
sep : float, default: 2
    Separation between the label and the size bar, in points.
frameon : bool, default: True
    If True, draw a box around the horizontal bar and label.
size_vertical : float, default: 0
    Vertical length of the size bar, given in coordinates of
    *transform*.
color : str, default: 'black'
    Color for the size bar and label.
label_top : bool, default: False
    If True, the label will be over the size bar.
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
    Font properties for the label text.
fill_bar : bool, optional
    If True and if *size_vertical* is nonzero, the size bar will
    be filled in with the color specified by the size bar.
    Defaults to True if *size_vertical* is greater than
    zero and False otherwise.
**kwargs
    Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
size_bar : `~matplotlib.offsetbox.AuxTransformBox`
    Container for the size bar.
txt_label : `~matplotlib.offsetbox.TextArea`
    Container for the label of the size bar.

Notes
-----
If *prop* is passed as a keyword argument, but *fontproperties* is
not, then *prop* is assumed to be the intended *fontproperties*.
Using both *prop* and *fontproperties* is not supported.

Examples
--------
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> from mpl_toolkits.axes_grid1.anchored_artists import (
...     AnchoredSizeBar)
>>> fig, ax = plt.subplots()
>>> ax.imshow(np.random.random((10, 10)))
>>> bar = AnchoredSizeBar(ax.transData, 3, '3 data units', 4)
>>> ax.add_artist(bar)
>>> fig.show()

Using all the optional parameters

>>> import matplotlib.font_manager as fm
>>> fontprops = fm.FontProperties(size=14, family='monospace')
>>> bar = AnchoredSizeBar(ax.transData, 3, '3 units', 4, pad=0.5,
...                       sep=5, borderpad=0.5, frameon=False,
...                       size_vertical=0.5, color='white',
...                       fontproperties=fontprops)
Nr   )r   r   )fill	facecolor	edgecolorr   color)r?   fontproperties)	textpropscenter)childrenalignr   sepr   )r   size_bar
add_artistr	   popr   	txt_labelr   _boxr   r   )r   r7   sizelabelr$   r   r   rE   r   size_verticalr?   	label_topr@   fill_barr%   rA   _box_childrenr&   s                    r'   r   AnchoredSizeBar.__init__   s    j $q(H'	2  64085:"< 	= !f&6#ZZ/N! %(I"'JI!%=!^^T]];M!]]DNN;M]"* !s,	 	 	I#$)),	IAG	Ir)   )rJ   rF   rI   )	皙?rR      Tr   blackFNNr,   r3   s   @r'   r   r      s    -.6=@DqI qIr)   r   c                   8   ^  \ rS rSr      SU 4S jjrSrU =r$ )r      c                   > Uc  0 nUc  0 n[        SUUUS9nUc  SU;   a  UR                  S5      nSU;  a  UUS'   SU;  a  UUS'   SU;  a  UUS'   SU;  a  UUS'   UnU[        R                  " 5       R	                  U5      -   n[        U5      U l        UnXH-  n[        SUU-  4UUU-  44USSS	.UD6U l        [        UU-  S4UU-  U44USSS	.UD6U l	        U R                  R                  U R                  5        U R                  R                  U R                  5        [        UU-   UU-  U-   4UUUS
9n[        U4SU0UD6U l        U R                  R                  U R                  5        [        UU-  U-   USU-
  -  U-   4X5US
9n[        U40 UD6U l        U R                  R                  U R                  5        [        TU ]@  " U4XU R                  US.UD6  g)aZ  
Draw two perpendicular arrows to indicate directions.

Parameters
----------
transform : `~matplotlib.transforms.Transform`
    The transformation object for the coordinate system in use, i.e.,
    :attr:`matplotlib.axes.Axes.transAxes`.
label_x, label_y : str
    Label text for the x and y arrows
length : float, default: 0.15
    Length of the arrow, given in coordinates of *transform*.
fontsize : float, default: 0.08
    Size of label strings, given in coordinates of *transform*.
loc : str, default: 'upper left'
    Location of the arrow.  Valid locations are
    'upper left', 'upper center', 'upper right',
    'center left', 'center', 'center right',
    'lower left', 'lower center', 'lower right'.
    For backward compatibility, numeric values are accepted as well.
    See the parameter *loc* of `.Legend` for details.
angle : float, default: 0
    The angle of the arrows in degrees.
aspect_ratio : float, default: 1
    The ratio of the length of arrow_x and arrow_y.
    Negative numbers can be used to change the direction.
pad : float, default: 0.4
    Padding around the labels and arrows, in fraction of the font size.
borderpad : float, default: 0.4
    Border padding, in fraction of the font size.
frameon : bool, default: False
    If True, draw a box around the arrows and labels.
color : str, default: 'white'
    Color for the arrows and labels.
alpha : float, default: 1
    Alpha values of the arrows and labels
sep_x, sep_y : float, default: 0.01 and 0 respectively
    Separation between the arrows and labels in coordinates of
    *transform*.
fontproperties : `~matplotlib.font_manager.FontProperties`, optional
    Font properties for the label text.
back_length : float, default: 0.15
    Fraction of the arrow behind the arrow crossing.
head_width : float, default: 10
    Width of arrow head, sent to `.ArrowStyle`.
head_length : float, default: 15
    Length of arrow head, sent to `.ArrowStyle`.
tail_width : float, default: 2
    Width of arrow tail, sent to `.ArrowStyle`.
text_props, arrow_props : dict
    Properties of the text and arrows, passed to `.TextPath` and
    `.FancyArrowPatch`.
**kwargs
    Keyword arguments forwarded to `.AnchoredOffsetbox`.

Attributes
----------
arrow_x, arrow_y : `~matplotlib.patches.FancyArrowPatch`
    Arrow x and y
text_path_x, text_path_y : `~matplotlib.text.TextPath`
    Path for arrow labels
p_x, p_y : `~matplotlib.patches.PathPatch`
    Patch for arrow labels
box : `~matplotlib.offsetbox.AuxTransformBox`
    Container for the arrows and labels.

Notes
-----
If *prop* is passed as a keyword argument, but *fontproperties* is
not, then *prop* is assumed to be the intended *fontproperties*.
Using both *prop* and *fontproperties* is not supported.

Examples
--------
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> from mpl_toolkits.axes_grid1.anchored_artists import (
...     AnchoredDirectionArrows)
>>> fig, ax = plt.subplots()
>>> ax.imshow(np.random.random((10, 10)))
>>> arrows = AnchoredDirectionArrows(ax.transAxes, '111', '110')
>>> ax.add_artist(arrows)
>>> fig.show()

Using several of the optional parameters, creating downward pointing
arrow and high contrast text labels.

>>> import matplotlib.font_manager as fm
>>> fontprops = fm.FontProperties(family='monospace')
>>> arrows = AnchoredDirectionArrows(ax.transAxes, 'East', 'South',
...                                  loc='lower left', color='k',
...                                  aspect_ratio=-1, sep_x=0.02,
...                                  sep_y=-0.01,
...                                  text_props={'ec':'w', 'fc':'k'},
...                                  fontproperties=fontprops)
NSimple)
head_widthhead_length
tail_widthr   r?   alphar   g        )
arrowstyleshrinkAshrinkB)rK   r   r7      )r   r   r   r   )r
   rH   r   Affine2D
rotate_degr   boxr   arrow_xarrow_yrG   r   r   p_xp_yr   r   ) r   r7   label_xlabel_ylengthfontsizer$   angleaspect_ratior   r   r   r?   r\   sep_xsep_yr@   back_lengthrY   rZ   r[   
text_propsarrow_propsr%   r]   t_startt_endlength_xlength_ytext_path_xtext_path_yr&   s                                   r'   r    AnchoredDirectionArrows.__init__   s\   N KJ+5,7+57

 !f&6#ZZ/N+%#(K +%#(K *$"'Jw*$"'Jw*--/::5AA"5)&&K();x/0 &  'X%q)X%x0 &  	DLL)DLL)UNK06 89@0 [JGJzJDHH%[ &!K-(@(F H9 [7J7DHH% 	4#$((!(	4,2	4r)   )rd   re   rc   rf   rg   )333333?g{Gz?z
upper leftr   r`   r+   r+   Fwr`   g{Gz?r   Nrz   
      rS   NNr,   r3   s   @r'   r   r      s!    ;?HIIJGK;<.2i4 i4r)   r   N)
matplotlibr   matplotlib.offsetboxr   r   r   r   r   matplotlib.patchesr	   r
   r   r   matplotlib.textr   __all__r   r   r   r    r)   r'   <module>r      se    !B B< < $99
+ 9
x4#/ 4#nrI' rIjj4/ j4r)   