403Webshell
Server IP : 35.80.110.71  /  Your IP : 216.73.216.221
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /usr/lib/python3/dist-packages/matplotlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/matplotlib/__pycache__/offsetbox.cpython-312.pyc
�

G8�c���>�dZddlZddlZddlmZmZddlmZ	ddl
mZddl
mZddlmZddlmZddlmZddlmZmZmZddlmZmZmZdZd	�Zd+d
�Z d,d�Z!Gd�d
e	jD�Z#Gd�de#�Z$Gd�de$�Z%Gd�de$�Z&Gd�de#�Z'Gd�de#�Z(Gd�de#�Z)Gd�de#�Z*Gd�de#�Z+d�Z,Gd�d e+�Z-Gd!�d"e#�Z.Gd#�d$e	jDej^�Z0Gd%�d&�Z1Gd'�d(e1�Z2Gd)�d*e1�Z3y)-ac
Container classes for `.Artist`\s.

`OffsetBox`
    The base of all container artists defined in this module.

`AnchoredOffsetbox`, `AnchoredText`
    Anchor and align an arbitrary `.Artist` or a text relative to the parent
    axes or a specific anchor point.

`DrawingArea`
    A container with fixed width and height. Children have a fixed position
    inside the container and may be clipped.

`HPacker`, `VPacker`
    Containers for layouting their children vertically or horizontally.

`PaddedBox`
    A container to add a padding around an `.Artist`.

`TextArea`
    Contains a single `.Text` instance.
�N)�_api�
_docstring)�FontProperties)�	BboxImage)�FancyBboxPatch�FancyArrowPatch�bbox_artist)�Bbox�BboxBase�TransformedBboxFc�(�trt|i|��yy�N)�DEBUG�mbbox_artist)�args�kwargss  �6/usr/lib/python3/dist-packages/matplotlib/offsetbox.pyr	r	,s����d�%�f�%�
�c��t|�\}}tjgd�|��|dk(r=tjdg|D�cgc]}||z��	c}z�}|dd}|�|d|z
}||fS|dk(re|�d}t|�dkDr|t
|�z
t|�dz
z}nd}tjdg|D�cgc]}||z��	c}z�}|dd}||fS|d	k(ret|�}	|�|�td
��|	|zt|�z}n|t|�z|	z
}|	|ztjt|��z}||fSycc}wcc}w)a�
    Pack boxes specified by their ``(width, xdescent)`` pair.

    For simplicity of the description, the terminology used here assumes a
    horizontal layout, but the function works equally for a vertical layout.

    *xdescent* is analogous to the usual descent, but along the x-direction; it
    is currently ignored.

    There are three packing *mode*\s:

    - 'fixed': The elements are packed tight to the left with a spacing of
      *sep* in between. If *total* is *None* the returned total will be the
      right edge of the last box. A non-*None* total will be passed unchecked
      to the output. In particular this means that right edge of the last
      box may be further to the right than the returned total.

    - 'expand': Distribute the boxes with equal spacing so that the left edge
      of the first box is at 0, and the right edge of the last box is at
      *total*. The parameter *sep* is ignored in this mode. A total of *None*
      is accepted and considered equal to 1. The total is returned unchanged
      (except for the conversion *None* to 1). If the total is smaller than
      the sum of the widths, the laid out boxes will overlap.

    - 'equal': If *total* is given, the total space is divided in N equal
      ranges and each box is left-aligned within its subspace.
      Otherwise (*total* is *None*), *sep* must be provided and each box is
      left-aligned in its subspace of width ``(max(widths) + sep)``. The
      total width is then calculated to be ``N * (max(widths) + sep)``.

    Parameters
    ----------
    wd_list : list of (float, float)
        (width, xdescent) of boxes to be packed.
    total : float or None
        Intended total length. *None* if not used.
    sep : float
        Spacing between boxes.
    mode : {'fixed', 'expand', 'equal'}
        The packing mode.

    Returns
    -------
    total : float
        The total width needed to accommodate the laid out boxes.
    offsets : array of float
        The left offsets of the boxes.
    )�fixed�expand�equal)�moderrN���r�rz@total and sep cannot both be None when using layout mode 'equal')
�zipr�
check_in_list�np�cumsum�len�sum�max�
ValueError�arange)
�wd_list�total�sepr�w_list�d_list�w�offsets_�offsets�maxhs
          r�_get_packed_offsetsr.1ss��b�'�]�N�F�F����3�$�?��w���9�9�a�S�V�#<��A��G�#<�<�=���3�B�-���=��R�L�3�&�E��g�~��	
��	��=��E��v�;��?��3�v�;�&�3�v�;��?�;�C��C��9�9�a�S�V�#<��A��G�#<�<�=���3�B�-���g�~��	
����6�{���=��{� �"=�>�>��C�Z�3�v�;�.�E��#�f�+�%��,�C��#�:����3�v�;�!7�7���g�~��
��'$=��$=s�D<
�3E
c���|�td�|D��}tjgd�|��|dk(r>td�|D��}td�|D��}||z}|D��cgc]\}}d��	}}}n`|dvrd}|D��cgc]\}}|��	}}}nE|d	vrd}|D��cgc]
\}}||z
|z��}}}n$|d
k(rd}|D��cgc]\}}||z
dz|z��}}}|fScc}}wcc}}wcc}}wcc}}w)au
    Align boxes each specified by their ``(height, descent)`` pair.

    For simplicity of the description, the terminology used here assumes a
    horizontal layout (i.e., vertical alignment), but the function works
    equally for a vertical layout.

    Parameters
    ----------
    hd_list
        List of (height, xdescent) of boxes to be aligned.
    height : float or None
        Intended total height. If None, the maximum of the heights in *hd_list*
        is used.
    align : {'baseline', 'left', 'top', 'right', 'bottom', 'center'}
        The alignment anchor of the boxes.

    Returns
    -------
    height
        The total height of the packing (if a value was originally passed in,
        it is returned without checking that it is actually large enough).
    descent
        The descent of the packing.
    offsets
        The bottom offsets of the boxes.
    c3�&K�|]	\}}|���y�wr���.0�h�ds   r�	<genexpr>z'_get_aligned_offsets.<locals>.<genexpr>�s����+�4�1�a�Q�+���)�baseline�left�top�right�bottom�center)�alignr8c3�,K�|]\}}||z
���y�wrr1r2s   rr6z'_get_aligned_offsets.<locals>.<genexpr>�s����7�t�q�!�Q��U�7�s�c3�&K�|]	\}}|���y�wrr1r2s   rr6z'_get_aligned_offsets.<locals>.<genexpr>�s����,�D�A�q�a�,�r7�)r9r:)r;r<r=��?)r"rr)�hd_list�heightr>�height_descent�descentr4r5r,s        r�_get_aligned_offsetsrG�s��:�~��+�7�+�+�����@��O�
�
���7�w�7�7���,�G�,�,���'�)��")�*�$�!�Q�2�*��*�	�/�	!���!(�)���A�1�)��)�	�%�	%���.5�6�d�a��6�A�:��>�6��6�	�(�	���5<�=�T�Q��F�Q�J�"�$�q�(�=��=��7�G�#�#��+��*��7��>s�!C�<C�C"�9C(c���eZdZdZ�fd�Z�fd�Zejjjd��Zd�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zdd�Zd�Z�xZS)�	OffsetBoxz�
    The OffsetBox is a simple container artist.

    The child artists are meant to be drawn at a relative position to its
    parent.

    Being an artist itself, all parameters are passed on to `.Artist`.
    c�~��t�|�|�|j|�|jd�g|_d|_y)NF�rr)�super�__init__�_internal_update�set_clip_on�	_children�_offset)�selfrr�	__class__s   �rrMzOffsetBox.__init__�s<���
���$�����f�%�	
����������rc�p��t�|�|�|j�D]}|j|��y)z�
        Set the `.Figure` for the `.OffsetBox` and all its children.

        Parameters
        ----------
        fig : `~matplotlib.figure.Figure`
        N)rL�
set_figure�get_children)rR�fig�crSs   �rrUzOffsetBox.set_figure�s6���	���3���"�"�$�	�A�
�L�L���	rc��tjjj||�|j	�D]}|��||_�yr)�martist�Artist�axes�fsetrV)rR�axrXs   rr\zOffsetBox.axes�sB��	����� � ��r�*��"�"�$�	�A��}����	rc��|j|�\}}|�||fS|j�D]}|j|�\}}|s�||fcSdifS)a�
        Delegate the mouse event contains-check to the children.

        As a container, the `.OffsetBox` does not respond itself to
        mouseevents.

        Parameters
        ----------
        mouseevent : `matplotlib.backend_bases.MouseEvent`

        Returns
        -------
        contains : bool
            Whether any values are within the radius.
        details : dict
            An artist-specific dictionary of details of the event context,
            such as which points are contained in the pick radius. See the
            individual Artist subclasses for details.

        See Also
        --------
        .Artist.contains
        F)�_default_containsrV�contains)rR�
mouseevent�inside�inforX�a�bs       rrazOffsetBox.contains�sj��0�-�-�j�9�������4�<���"�"�$�	�A��:�:�j�)�D�A�q���!�t��	��b�y�rc� �||_d|_y)a�
        Set the offset.

        Parameters
        ----------
        xy : (float, float) or callable
            The (x, y) coordinates of the offset in display units. These can
            either be given explicitly as a tuple (x, y), or by providing a
            function that converts the extent into the offset. This function
            must have the signature::

                def offset(width, height, xdescent, ydescent, renderer) -> (float, float)
        TN)rQ�stale�rR�xys  r�
set_offsetzOffsetBox.set_offsets�������
rc�n�t|j�r|j|||||�S|jS)a�
        Return the offset as a tuple (x, y).

        The extent parameters have to be provided to handle the case where the
        offset is dynamically determined by a callable (see
        `~.OffsetBox.set_offset`).

        Parameters
        ----------
        width, height, xdescent, ydescent
            Extent parameters.
        renderer : `.RendererBase` subclass

        )�callablerQ)rR�widthrD�xdescent�ydescent�renderers      r�
get_offsetzOffsetBox.get_offsets7�� �D�L�L�)����U�F�H�h��I�	#��\�\�	#rc� �||_d|_y)zh
        Set the width of the box.

        Parameters
        ----------
        width : float
        TN)rnrh)rRrns  r�	set_widthzOffsetBox.set_width's����
���
rc� �||_d|_y)zj
        Set the height of the box.

        Parameters
        ----------
        height : float
        TN)rDrh)rRrDs  r�
set_heightzOffsetBox.set_height2s�������
rc�b�|jD�cgc]}|j�s�|��c}Scc}w)z/Return a list of the visible child `.Artist`\s.)rP�get_visible)rRrXs  r�get_visible_childrenzOffsetBox.get_visible_children=s"���>�>�=�a�Q�]�]�_��=�=��=s�,�,c��|jS)z'Return a list of the child `.Artist`\s.)rP�rRs rrVzOffsetBox.get_childrenA����~�~�rc��td��)a-
        Update offset of the children and return the extent of the box.

        Parameters
        ----------
        renderer : `.RendererBase` subclass

        Returns
        -------
        width
        height
        xdescent
        ydescent
        list of (xoffset, yoffset) pairs
        z9get_extent_offsets must be overridden in derived classes.)�NotImplementedError�rRrqs  r�get_extent_offsetszOffsetBox.get_extent_offsetsEs�� "�G�I�	Irc�<�|j|�\}}}}}||||fS)z@Return a tuple ``width, height, xdescent, ydescent`` of the box.)r�)rRrqr*r4�xd�ydr,s       r�
get_extentzOffsetBox.get_extentXs+�� $� 7� 7�� A���1�b�"�g��!�R��|�rc���|�|jj�}|j|�\}}}}}|j|||||�\}}tj
j
||z
||z
||�Sr)�figure�
_get_rendererr�rr�mtransformsr
�from_bounds)	rRrqr*r4r�r�r,�px�pys	         r�get_window_extentzOffsetBox.get_window_extent]st�����{�{�0�0�2�H� $� 7� 7�� A���1�b�"�g�����A�r�2�x�8���B����+�+�B��G�R�"�W�a��C�Crc�@�|j|�\}}}}}|j|||||�\}}t|j�|�D]2\}	\}
}|	j	||
z||zf�|	j|��4t
||dtd����d|_y)zm
        Update the location of children if necessary and draw them
        to the given *renderer*.
        FrA��pad��fill�propsN)	r�rrrryrk�drawr	�dictrh�rRrqr*r4rorpr,r�r�rX�ox�oys            rr�zOffsetBox.drawes���
-1�,C�,C�H�,M�)��1�h��'�����A�x��8�D���B��t�8�8�:�G�D�	�K�A�x��B�
�L�L�"�r�'�2��7�+�,�
�F�F�8��	�	�D�(��d�r�l�C���
rr)�__name__�
__module__�__qualname__�__doc__rMrUrZr[r\�setterrarkrrrtrvryrVr�r�r�r��
__classcell__�rSs@rrIrI�sp�����
�
�^�^������ ���B�$#�&	�	�>��I�&�
D�rrIc�$��eZdZ		d�fd�	Z�xZS)�
PackerBasec���t�|��||_||_||_||_||_||_||_y)ag
        Parameters
        ----------
        pad : float, optional
            The boundary padding in points.

        sep : float, optional
            The spacing between items in points.

        width, height : float, optional
            Width and height of the container box in pixels, calculated if
            *None*.

        align : {'top', 'bottom', 'left', 'right', 'center', 'baseline'}, default: 'baseline'
            Alignment of boxes.

        mode : {'fixed', 'expand', 'equal'}, default: 'fixed'
            The packing mode.

            - 'fixed' packs the given `.Artist`\s tight with *sep* spacing.
            - 'expand' uses the maximal available space to distribute the
              artists with equal spacing in between.
            - 'equal': Each artist an equal fraction of the available space
              and is left-aligned (or top-aligned) therein.

        children : list of `.Artist`
            The artists to pack.

        Notes
        -----
        *pad* and *sep* are in points and will be scaled with the renderer
        dpi, while *width* and *height* are in pixels.
        N)	rLrMrDrnr'r�rr>rP)	rRr�r'rnrDr>r�childrenrSs	        �rrMzPackerBase.__init__tsB���H	���������
���������	���
�!��r)NNNNr8rN)r�r�r�rMr�r�s@rr�r�ss���>B�:>�+"�+"rr�c��eZdZdZd�Zy)�VPackerzs
    VPacker packs its children vertically, automatically adjusting their
    relative positions at draw time.
    c��|jd�}|j|z}|j|z}|j�Q|j	�D]>}t|t�s�|jdk(s�$|j|j��@|j	�D�cgc]}|j|���}}|D���	�
cgc]\}}}	}
|||	||
z
f��}}	}}}
|D���	�
cgc]\}}}	}
||	f��
}}	}}}
t||j|j�\}}
}|D���	�
cgc]\}}}	}
||
f��
}}	}}}
t||j||j�\}}||D���	�
cgc]	\}}}	}
|
��c}
}	}}z}||dz
}||z
}||z
}|d|zz|d|zz|
|z||ztt||��fScc}wcc}
}	}}wcc}
}	}}wcc}
}	}}wcc}
}	}}w)N��?rr�)�points_to_pixelsr�r'rnry�
isinstancer�rrtr�rGr>r.rD�listr)rRrq�dpicorr�r'rX�whd_listr*r4r�r�r%rnro�xoffsets�	pack_listrD�	yoffsets_�yoffsetsrps                    rr�zVPacker.get_extent_offsets�s����*�*�2�.���h�h�����h�h�����:�:�!��.�.�0�
,���a��,����8�1C��K�K��
�
�+�
,�
"�6�6�8�:���L�L��*�:��:�=E�F�F�\�Q��2�r�Q��2��B��(�F��F�/7�8�8�|�q�!�R��A�r�7�8��8�$8��9=���9=���%E�!��x��2:�:�:���A�r�2�a��W�:�	�:�/�	�4�;�;�03�T�Y�Y�@���	��x�@�@�|�q�!�R���@�@���H�Q�K�'���H�$���h�&����C����!�c�'�!1��3���3���S��8�,�-�/�	/��':��F��8��
;�� As�F8�F=
�!G
�"G
�$GN�r�r�r�r�r�r1rrr�r��s���
 /rr�c��eZdZdZd�Zy)�HPackerzu
    HPacker packs its children horizontally, automatically adjusting their
    relative positions at draw time.
    c���|jd�}|j|z}|j|z}|j�D�cgc]}|j	|���}}|s
d|zd|z||gfS|D���	�
cgc]\}}}	}
||
f��
}}	}}}
t||j|j�\}}
}|D���	�
cgc]\}}}	}
||	f��
}}	}}}
t||j||j�\}}||D���	�
cgc]	\}}}	}
|	��c}
}	}}z}|dd}||z
}|d|zz|d|zz||z|
|ztt||��fScc}wcc}
}	}}wcc}
}	}}wcc}
}	}}w�Nr�r�r)
r�r�r'ryr�rGrDr>r.rnrr�r)rRrqr�r�r'rXr�r*r4r�r�rCrDrpr�r�rn�	xoffsets_r�ros                    rr�zHPacker.get_extent_offsets�s����*�*�2�.���h�h�����h�h����"�6�6�8�:���L�L��*�:��:���s�7�A��G�S�#�r�1�1�/7�8�8�|�q�!�R��A�r�7�8��8�%9�'�:>�+�+�:>�*�*�&F�"���(�2:�:�:���A�r�2�a��W�:�	�:�.�y�$�*�*�/2�D�I�I�?���y��x�@�@�|�q�!�R���@�@���A�;�q�>���h�&����C����!�c�'�!1��3���3���S��8�,�-�/�	/��+:��9��
;��
 As�E�2E	
�3E
�5ENr�r1rrr�r��s���
/rr�c�l��eZdZdZej
dd��d
�fd�	�Zd�Zd�Zdd�Z	d	�Z
�xZS)�	PaddedBoxz�
    A container to add a padding around an `.Artist`.

    The `.PaddedBox` contains a `.FancyBboxPatch` that is used to visualize
    it when rendering.
    �3.6�
draw_frame��namec���t�|��||_|g|_t	ddddddd|d��	|_|�|j
j
|�y	y	)
a
        Parameters
        ----------
        child : `~matplotlib.artist.Artist`
            The contained `.Artist`.
        pad : float
            The padding in points. This will be scaled with the renderer dpi.
            In contrast, *width* and *height* are in *pixels* and thus not
            scaled.
        draw_frame : bool
            Whether to draw the contained `.FancyBboxPatch`.
        patch_attrs : dict or None
            Additional parameters passed to the contained `.FancyBboxPatch`.
        �rArAr�r*�krT�square,pad=0�	rjrnrD�	facecolor�	edgecolor�mutation_scale�snap�visible�boxstyleN)rLrMr�rPr�patch�update)rR�childr�r��patch_attrsrSs     �rrMzPaddedBox.__init__�sc��� 	�����������#���B��S����#�

��
��"��J�J���k�*�#rc��|jd�}|j|z}|jdj|�\}}}}|d|zz|d|zz||z||zdgfS)Nr�rr�rK)r�r�rPr�)rRrqr�r�r*r4r�r�s        rr�zPaddedBox.get_extent_offsetssq���*�*�2�.���h�h�����~�~�a�(�3�3�H�=���1�b�"��A��G��Q��S��[�"�s�(�B��H����	rc�Z�|j|�\}}}}}|j|||||�\}}t|j�|�D]!\}	\}
}|	j	||
z||zf��#|j|�|j�D]}	|	j
|��d|_y�NF)r�rrrryrkr�r�rhr�s            rr�zPaddedBox.draws���,0�,C�,C�H�,M�)��1�h��'�����A�x��8�D���B��t�8�8�:�G�D�	-�K�A�x��B�
�L�L�"�r�'�2��7�+�,�	-�	
����!��*�*�,�	�A�
�F�F�8��	���
rc��|jj|j�|r|jj|�d|_y�NT)r��
set_bounds�bounds�set_mutation_scalerh�rR�bbox�fontsizes   r�update_framezPaddedBox.update_frame-s4���
�
���d�k�k�*���J�J�)�)�(�3���
rc�z�|j|j|��|jj|�yr)r�r�r�r�rs  rr�zPaddedBox.draw_frame3s+�����$�0�0��:�;��
�
����!r)NFNr)r�r�r�r�r�make_keyword_onlyrMr�r�r�r�r�r�s@rr�r��s?�����T���E��5�+�6�+�:���"rr�c���eZdZdZd
�fd�	Zed��Zejd��Zd�Zd�Z	d�Z
d�Zdd	�Zd
�Z
d�Zd�Z�xZS)�DrawingAreaz�
    The DrawingArea can contain any Artist as a child. The DrawingArea
    has a fixed width and height. The position of children relative to
    the parent is fixed. The children can be clipped at the
    boundaries of the parent.
    c����t�|��||_||_||_||_||_tj�|_	tj�|_
y)a"
        Parameters
        ----------
        width, height : float
            Width and height of the container box.
        xdescent, ydescent : float
            Descent of the box in x- and y-direction.
        clip : bool
            Whether to clip the children to the box.
        N)rLrMrnrDrorp�_clip_childrenr��Affine2D�offset_transform�
dpi_transform)rRrnrDrorp�cliprSs      �rrMzDrawingArea.__init__AsV���	������
���� ��
� ��
�"��� +� 4� 4� 6���(�1�1�3��rc��|jS)zl
        If the children of this DrawingArea should be clipped
        by DrawingArea bounding box.
        )r�r{s r�
clip_childrenzDrawingArea.clip_childrenUs���"�"�"rc�2�t|�|_d|_yr�)�boolr�rh)rR�vals  rr�zDrawingArea.clip_children]s��"�3�i�����
rc�4�|j|jzS)zX
        Return the `~matplotlib.transforms.Transform` applied to the children.
        )r�r�r{s r�
get_transformzDrawingArea.get_transformbs���!�!�D�$9�$9�9�9rc��y�z+
        set_transform is ignored.
        Nr1�rR�ts  r�
set_transformzDrawingArea.set_transformh��rc��||_|jj�|jj|d|d�d|_y�z�
        Set the offset of the container.

        Parameters
        ----------
        xy : (float, float)
            The (x, y) coordinates of the offset in display units.
        rrTN�rQr��clear�	translaterhris  rrkzDrawingArea.set_offsetm�B��������#�#�%����'�'��1��r�!�u�5���
rc��|jS�zReturn offset of the container.�rQr{s rrrzDrawingArea.get_offset{����|�|�rc���|�|jj�}|j|�\}}}}|j�\}}tj
j
||z
||z
||�Sr�r�r�r�rrr�r
r��rRrqr*r4r�r�r�r�s        rr�zDrawingArea.get_window_extentse�����{�{�0�0�2�H����x�0���1�b�"����"���B����+�+�B��G�R�"�W�a��C�Crc��|jd�}|j|z|j|z|j|z|j|zfS)z0Return width, height, xdescent, ydescent of box.r�)r�rnrDrorp)rRrq�dpi_cors   rr�zDrawingArea.get_extent�sL���+�+�B�/���
�
�W�$�d�k�k�G�&;��
�
��'�����)@�B�	Brc��|jj|�|j�s|j|j	��|j
�|j
|_|j}|�|j|�yy)�&Add an `.Artist` to the container box.N)rP�append�is_transform_setr�r�r\r�rU)rRrerWs   r�
add_artistzDrawingArea.add_artist�si�������a� ��!�!�#�
�O�O�D�.�.�0�1��9�9� ��Y�Y�A�F��k�k���?�
�L�L���rc	�T�|jd�}|jj�|jj|�t	j
t
jddgd|jg|j|jg|jdgg�|j��}|jD]H}|jr)|js|js|j|�|j!|��Jt#||dt%d����d|_y)Nr�rFrAr�r�)r�r�r��scaler��TransformedPath�mpath�PathrDrnr�rPr��clipbox�	_clippath�
set_clip_pathr�r	r�rh)rRrqr��tpathrXs     rr�zDrawingArea.draw�s����+�+�B�/����� � �"���� � ��)�
�+�+��J�J��A���D�K�K� 0����T�[�[�1����Q��)�
*�
��� �	"��
���	�A��"�"�A�I�I��������&�
�F�F�8��	�
	�D�(��d�r�l�C���
r)rArAFr)r�r�r�r�rM�propertyr�r�r�r�rkrrr�r�rr�r�r�s@rr�r�9se����4�(�#��#�������:��
��D�B�	�rr�c���eZdZdZej
dd��		d�fd�	�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zd�Z
dd
�Zd�Zd�Z�xZS)�TextAreaz�
    The TextArea is a container artist for a single Text instance.

    The text is placed at (0, 0) with baseline+left alignment, by default. The
    width and height of the TextArea instance is the width and height of its
    child text.
    r��	textpropsr�c�^��|�i}tjdd|fi|��|_t�|��|jg|_t
j�|_t
j�|_	|jj|j|jz�||_y)a�
        Parameters
        ----------
        s : str
            The text to be displayed.
        textprops : dict, default: {}
            Dictionary of keyword parameters to be passed to the `.Text`
            instance in the TextArea.
        multilinebaseline : bool, default: False
            Whether the baseline for multiline text is adjusted so that it
            is (approximately) center-aligned with single-line text.
        Nr)�mtext�Text�_textrLrMrPr�r�r��_baseline_transformr��_multilinebaseline)rR�sr�multilinebaselinerSs    �rrMzTextArea.__init__�s����"���I��Z�Z��1�a�5�9�5��
�
�����*�*���� +� 4� 4� 6���#.�#7�#7�#9�� ��
�
� � ��!6�!6�!%�!9�!9�":�	;�"3��rc�H�|jj|�d|_y)z&Set the text of this area as a string.TN)r�set_textrh�rRrs  rrzTextArea.set_text�s���
�
���A����
rc�6�|jj�S)z5Return the string representation of this area's text.)r�get_textr{s rrzTextArea.get_text�s���z�z�"�"�$�$rc� �||_d|_y)aX
        Set multilinebaseline.

        If True, the baseline for multiline text is adjusted so that it is
        (approximately) center-aligned with single-line text.  This is used
        e.g. by the legend implementation so that single-line labels are
        baseline-aligned, but multiline labels are "center"-aligned with them.
        TN)rrhr�s  r�set_multilinebaselinezTextArea.set_multilinebaseline�s��#$�����
rc��|jS)z(
        Get multilinebaseline.
        )rr{s r�get_multilinebaselinezTextArea.get_multilinebaseline�s���&�&�&rc��yr�r1r�s  rr�zTextArea.set_transform�r�rc��||_|jj�|jj|d|d�d|_yr�r�ris  rrkzTextArea.set_offset�r�rc��|jSr�r�r{s rrrzTextArea.get_offsetr�rc���|�|jj�}|j|�\}}}}|j�\}}tj
j
||z
||z
||�Srr�r�s        rr�zTextArea.get_window_extent�e�����{�{�0�0�2�H����x�0���1�b�"����"���B����+�+�B��G�R�"�W�a��C�Crc�X�|jd|jj|jj�rdnd��\}}}|jj	|�\}}}|j
\}}	|jj�t|�dkDr<|jr0d|	zd||z
zz
}
|jjd||
z
�|
}nt||z
|	|z
�}||z}	|jj�}|dk(rd}
n|d	k(r|d
z}
n|dk(r|}
||	
|fS)N�lp�TeXF)�ismathrrBrr9r=r�r;)
�get_text_width_height_descentr�_fontproperties�
get_usetex�_get_layout�sizerr�r rr�r"�get_horizontalalignment)rRrq�_�h_�d_r�rdr�r*r4�yd_new�h_d�har�s              rr�zTextArea.get_extents)���:�:��$�*�*�,�,� �J�J�1�1�3�5��;�@�	��2�r����/�/��9���d�B��y�y���1�� � �&�&�(��t�9�q�=�T�4�4��1�W�s�b�2�g��.�F��$�$�.�.�q�"�v�+�>��B��b�2�g�q�2�v�&�C��b��A�
�Z�Z�
/�
/�
1��
��<��B�
�8�^��Q��B�
�7�]��B��!�R��|�rc�z�|jj|�t||dtd����d|_y�NFrAr�r�)rr�r	r�rhrs  rr�z
TextArea.draw,s+���
�
����!��D�(��d�r�l�C���
rr�r)r�r�r�r�rr�rMrrrr r�rkrrr�r�r�r�r�s@rrr�sd�����T���E��4��#(�4�5�4�6�
%�
�'��
��D��8rrc�T��eZdZdZ�fd�Zd�Zd�Zd�Zd�Zd�Z	dd�Z
d	�Zd
�Z�xZ
S)�AuxTransformBoxaZ
    Offset Box with the aux_transform. Its children will be
    transformed with the aux_transform first then will be
    offsetted. The absolute coordinate of the aux_transform is meaning
    as it will be automatically adjust so that the left-lower corner
    of the bounding box of children will be set to (0, 0) before the
    offset transform.

    It is similar to drawing area, except that the extent of the box
    is not predetermined but calculated from the window extent of its
    children. Furthermore, the extent of the children will be
    calculated in the transformed coordinate.
    c���||_t�|�	�tj�|_tj�|_yr)�
aux_transformrLrMr�r�r��ref_offset_transform)rRr;rSs  �rrMzAuxTransformBox.__init__As:���*���
���� +� 4� 4� 6���%0�$8�$8�$:��!rc��|jj|�|j|j��d|_y)r�TN)rPrr�r�rh)rRres  rrzAuxTransformBox.add_artistIs0�������a� �	����*�*�,�-���
rc�N�|j|jz|jzS)zf
        Return the :class:`~matplotlib.transforms.Transform` applied
        to the children
        )r;r<r�r{s rr�zAuxTransformBox.get_transformOs.��
�"�"��+�+�,��'�'�(�	)rc��yr�r1r�s  rr�zAuxTransformBox.set_transformXr�rc��||_|jj�|jj|d|d�d|_yr�r�ris  rrkzAuxTransformBox.set_offset]r�rc��|jSr�r�r{s rrrzAuxTransformBox.get_offsetkr�rc���|�|jj�}|j|�\}}}}|j�\}}tj
j
||z
||z
||�Srr�r�s        rr�z!AuxTransformBox.get_window_extentor%rc��|jj�}|jj�|jj�|jD�cgc]}|j|���}}tjj|�}|jj|j|j�|jj|�|j|jddfScc}w)NrA)r��
get_matrixr<r�rPr�r�r
�unionr��x0�y0�
set_matrixrnrD)rRrq�_offrX�bboxes�ubs      rr�zAuxTransformBox.get_extentws����$�$�/�/�1���!�!�'�'�)����#�#�%�9=���H�A�!�%�%�h�/�H��H�
�
�
�
#�
#�F�
+���!�!�+�+�R�U�U�F�R�U�U�F�;����(�(��.��x�x����B��*�*��Is�C=c��|jD]}|j|��t||dtd����d|_yr7)rPr�r	r�rh)rRrqrXs   rr�zAuxTransformBox.draw�s:�����	�A�
�F�F�8��	��D�(��d�r�l�C���
rr)r�r�r�r�rMrr�r�rkrrr�r�r�r�r�s@rr9r93s6����;��)��
��D�
+�rr9c���eZdZdZdZdddddddd	d
dd�
Zejd
d��				d�fd�	�Zd�Z	d�Z
d�Zd�Zd�Z
dd�Zdd�Zdd�Zdd�Zd�Z�xZS)�AnchoredOffsetboxa0
    An offset box placed according to location *loc*.

    AnchoredOffsetbox has a single child.  When multiple children are needed,
    use an extra OffsetBox to enclose them.  By default, the offset box is
    anchored against its parent axes. You may explicitly specify the
    *bbox_to_anchor*.
    �rr�������	�
)
zupper rightz
upper leftz
lower leftzlower rightr;zcenter leftzcenter rightzlower centerzupper centerr=r�r�r�c	�V��t�
|�d
i|	��|j||�|j|�t	|t
�r!t
j|j|��}||_	||_
||_|�#ttjd��|_nZtj |�|_t	|t"�r0d|vr,|jj%tjd�t'ddddd	|jj)�d
|d��	|_y)a
        Parameters
        ----------
        loc : str
            The box location.  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 as fraction of the fontsize.
        borderpad : float, default: 0.5
            Padding between the offsetbox frame and the *bbox_to_anchor*.
        child : `.OffsetBox`
            The box that will be anchored.
        prop : `.FontProperties`
            This is only used as a reference for paddings. If not given,
            :rc:`legend.fontsize` is used.
        frameon : bool
            Whether to draw a frame around the box.
        bbox_to_anchor : `.BboxBase`, 2-tuple, or 4-tuple of floats
            Box that is used to position the legend in conjunction with *loc*.
        bbox_transform : None or :class:`matplotlib.transforms.Transform`
            The transform for the bounding box (*bbox_to_anchor*).
        **kwargs
            All other parameters are passed on to `.OffsetBox`.

        Notes
        -----
        See `.Legend` for a detailed description of the anchoring mechanism.
        )�locN�legend.fontsize�r.r.r�r�r*r�Tr�r�r1)rLrM�set_bbox_to_anchor�	set_childr��strr�
check_getitem�codesrX�	borderpadr�r�mpl�rcParams�prop�	_from_anyr��set_sizer�get_size_in_pointsr�)rRrXr�r`r�rc�frameon�bbox_to_anchor�bbox_transformrrSs          �rrMzAnchoredOffsetbox.__init__�s����N	���"�6�"������?����u���c�3���$�$�T�Z�Z�S�9�C����"�������<�&�C�L�L�9J�,K�L�D�I�&�0�0��6�D�I��$��%�&��*<��	�	�"�"�3�<�<�0A�#B�C�#���B��S��9�9�7�7�9���#�

��
rc�F�||_|�|j|_d|_y)zSet the child to be anchored.NT)�_childr\rh)rRr�s  rr\zAnchoredOffsetbox.set_child�s!����������E�J���
rc��|jS)zReturn the child.�rkr{s r�	get_childzAnchoredOffsetbox.get_child�s���{�{�rc��|jgS)zReturn the list of children.rmr{s rrVzAnchoredOffsetbox.get_children�s�����}�rc���|j�j|�\}}}}|j|jj	��}|j
|z}|d|zz|d|zz||z||zfS)z�
        Return the extent of the box as (width, height, x, y).

        This is the extent of the child plus the padding.
        r�)rnr�r�rcrfr�)rRrqr*r4r�r�r�r�s        rr�zAnchoredOffsetbox.get_extent�su���~�~�'�2�2�8�<���1�b�"��,�,�T�Y�Y�-I�-I�-K�L���h�h��!���1�s�7�{�A��C��K��c��2��8�;�;rc��|j�|jjS|j}|�|jSt	|j|�S)z,Return the bbox that the box is anchored to.)�_bbox_to_anchorr\r��_bbox_to_anchor_transformr)rR�	transforms  r�get_bbox_to_anchorz$AnchoredOffsetbox.get_bbox_to_anchorsL�����'��9�9�>�>�!��6�6�I�� ��+�+�+�&�t�';�';�Y�G�Grc��|�t|t�r||_n4	t|�}|dk(r|d|dddg}t
j|�|_||_d|_	y#t$r}td|���|�d}~wwxYw)aB
        Set the bbox that the box is anchored to.

        *bbox* can be a Bbox instance, a list of [left, bottom, width,
        height], or a list of [left, bottom] where the width and
        height will be assumed to be zero. The bbox will be
        transformed to display coordinate by the given transform.
        NzInvalid bbox: r�rrT)
r�rrrr �	TypeErrorr#r
r�rsrh)rRr�rt�l�errs     rr[z$AnchoredOffsetbox.set_bbox_to_anchors����<�:�d�H�5�#'�D� �
C���I���A�v��Q���a��!�Q�/��#'�#3�#3�T�#:�D� �)2��&���
���
C� �>�$��!8�9�s�B��
C�s�A�	A;�'A6�6A;c���|�|jj�}|j|�|j|�\}}}}|j	|||||�\}}tj||z
||z
||�Sr)r�r��_update_offset_funcr�rrr
r�r�s        rr�z#AnchoredOffsetbox.get_window_extent(sw�����{�{�0�0�2�H�� � ��*����x�0���1�b�"�����A�r�2�x�8���B�����R���b��!�Q�7�7rc������)|j�jj�����fd�}�j|�y)zs
        Update the offset func which depends on the dpi of the
        renderer (because of the padding).
        Nc���tjdd||�}�j�
z}�j�}t	�j
|||�\}}	||z|	|zfS)Nr)r
r�r`ru�_get_anchored_bboxrX)r*r4r�r�rqr�r`rhrFrGr�rRs          ��rrQz6AnchoredOffsetbox._update_offset_func.<locals>._offset;sc����#�#�A�q�!�Q�/�D�����1�I�!�4�4�6�N�'����$��	�;�F�B����7�B��G�#�#r)r�rcrfrk)rRrqr�rQs` ` rr{z%AnchoredOffsetbox._update_offset_func2s>���
���0�0��	�	�,�,�.�0�H�	$�	
���� rc��|jj|j�|r|jj|�yyr)r�r�r�r�r�s   rr�zAnchoredOffsetbox.update_frameEs2���
�
���d�k�k�*���J�J�)�)�(�3�rc��|j�sy|j|jj��}|j	||�|j|�}|j
||�|jj|�|j|�\}}}}|j|||||�\}}	|j�j||	f�|j�j|�d|_
yr�)rxr�rcrfr{r�r�r�r�r�rrrnrkrh)
rRrqr�r�rnrDrorpr�r�s
          rr�zAnchoredOffsetbox.drawJs������!���,�,�T�Y�Y�-I�-I�-K�L��� � ��8�4��%�%�h�/�����$��)��
�
����!�,0�O�O�H�,E�)��v�x��������(�H�M���B�����#�#�R��H�-�������h�'���
r)皙�����?rBNNTNNr)r�r�r�r��zorderr_rr�rMr\rnrVr�rur[r�r{r�r�r�r�s@rrNrN�s������F�����������

�E��T���E��.�$'�04� $� $�	@
�/�@
�D���
<�	H��28�!�&4�
rrNc�n�gd�|}|j|�}|j||��jS)z}
    Return the (x, y) position of the *bbox* anchored at the *parentbbox* with
    the *loc* code with the *borderpad*.
    )N�NE�NW�SW�SE�E�Wr��S�N�C)�	container)�padded�anchored�p0)rXr��
parentbboxr`rXr�s      rr~r~`s:��	E�S�I�A��!�!�9�*�-�I��=�=��i�=�0�3�3�3rc�R��eZdZdZej
dd��d�fd�	�Z�xZS)�AnchoredTextz&
    AnchoredOffsetbox with Text.
    r�r�r�c����|�i}ddh}|t|�zrtd��t||��|_|jjj�}t
�	|�|f|||j|d�|��y)aq
        Parameters
        ----------
        s : str
            Text.

        loc : str
            Location code. See `AnchoredOffsetbox`.

        pad : float, default: 0.4
            Padding around the text as fraction of the fontsize.

        borderpad : float, default: 0.5
            Spacing between the offsetbox frame and the *bbox_to_anchor*.

        prop : dict, optional
            Dictionary of keyword parameters to be passed to the
            `~matplotlib.text.Text` instance contained inside AnchoredText.

        **kwargs
            All other parameters are passed to `AnchoredOffsetbox`.
        N�va�verticalalignmentz<Mixing verticalalignment with AnchoredText is not supported.)r)r�r`r�rc)�setr#r�txtr�get_fontpropertiesrLrM)
rRrrXr�r`rcr�	badkwargs�fprSs
         �rrMzAnchoredText.__init__qs����2�<��D��.�/�	��s�4�y� ��N�P�
P��A��.���
�X�X�^�^�
.�
.�
0��
����	��I�T�X�X�B�	��	r)r�rBN)r�r�r�r�rr�rMr�r�s@rr�r�ls+�����T���E��.�#�/�#rr�c���eZdZejdd��									d�fd�	�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zdd�Zd�Z
d
�Z�xZS)�OffsetImager��zoomr�c����t�|��|
|_td|j|||||||	d�|��|_|j
g|_|j|�|j|�y)N)r��cmap�norm�
interpolation�origin�
filternorm�	filterrad�resampler1)	rLrM�_dpi_corrr��imagerP�set_zoom�set_data)
rR�arrr�r�r�r�r�r�r�r�r�rrSs
            �rrMzOffsetImage.__init__�sv���	������
��	!�D�$:�$:�$(�$(�-:�&,�*4�)2�(0�	!�"(�	!��
��*�*�����
�
�d���
�
�c�rc��tj|�|_|jj	|j�d|_yr�)r�asarray�_datar�r�rh)rRr�s  rr�zOffsetImage.set_data�s.���Z�Z��_��
��
�
���D�J�J�'���
rc��|jSr)r�r{s r�get_datazOffsetImage.get_data�����z�z�rc� �||_d|_yr�)�_zoomrh)rRr�s  rr�zOffsetImage.set_zoom�s����
���
rc��|jSr)r�r{s r�get_zoomzOffsetImage.get_zoom�r�rc��|jSr�r�r{s rrrzOffsetImage.get_offset�r�rc��|jgSr)r�r{s rrVzOffsetImage.get_children�s���
�
�|�rc���|�|jj�}|j|�\}}}}|j�\}}tj
j
||z
||z
||�Srr�r�s        rr�zOffsetImage.get_window_extent�r%rc���|jr|jd�}nd}|j�}|j�}|jdd\}}||z|z||z|z}}||ddfSr�)r�r�r�r��shape)	rRrqr�r��data�ny�nxr*r4s	         rr�zOffsetImage.get_extent�sp���=�=��/�/��3�G��G��}�}����}�}������B�Q����B���|�d�"�G�b�L�4�$7�1���!�Q��z�rc�H�|jj|�d|_yr�)r�r�rhrs  rr�zOffsetImage.draw�s���
�
����!���
r)	rNNNNTg@FTr)r�r�r�rr�rMr�r�r�r�rrrVr�r�r�r�r�s@rr�r��sn����T���E��/����#�� �����0��@�
�����D��rr�c�$�eZdZdZdZd�Zejejdd��									dd���Z
ed	��Zejd
��Zed��Zejd��Zd
�Zd�Zd�Zdd�Zd�Zdd�Zdd�Zd�Zd�Zy)�AnnotationBboxz�
    Container for an `OffsetBox` referring to a specific position *xy*.

    Optionally an arrow pointing from the offsetbox to *xy* can be drawn.

    This is like `.Annotation`, but with `OffsetBox` instead of `.Text`.
    rPc�D�d|jd|jdfzS)NzAnnotationBbox(%g,%g)rr)rjr{s r�__str__zAnnotationBbox.__str__�s"��&�$�'�'�!�*�d�g�g�a�j�)A�A�Arr��xycoordsr�Nc

��tjj|�tjj||||��||_|�|j
�nd|_|j|�|�|n||_	|�|n||_
|	|_|�<|jjdd�|_
td
i|j��|_nd|_
d|_t!ddddd|j"j%�d	|�
�|_|j&j)d|��|
r|j&j*di|
��|j-|
�y)a

        Parameters
        ----------
        offsetbox : `OffsetBox`

        xy : (float, float)
            The point *(x, y)* to annotate. The coordinate system is determined
            by *xycoords*.

        xybox : (float, float), default: *xy*
            The position *(x, y)* to place the text at. The coordinate system
            is determined by *boxcoords*.

        xycoords : single or two-tuple of str or `.Artist` or `.Transform` or callable, default: 'data'
            The coordinate system that *xy* is given in. See the parameter
            *xycoords* in `.Annotation` for a detailed description.

        boxcoords : single or two-tuple of str or `.Artist` or `.Transform` or callable, default: value of *xycoords*
            The coordinate system that *xybox* is given in. See the parameter
            *textcoords* in `.Annotation` for a detailed description.

        frameon : bool, default: True
            By default, the text is surrounded by a white `.FancyBboxPatch`
            (accessible as the ``patch`` attribute of the `.AnnotationBbox`).
            If *frameon* is set to False, this patch is made invisible.

        annotation_clip: bool or None, default: None
            Whether to clip (i.e. not draw) the annotation when the annotation
            point *xy* is outside the axes area.

            - If *True*, the annotation will be clipped when *xy* is outside
              the axes.
            - If *False*, the annotation will always be drawn.
            - If *None*, the annotation will be clipped when *xy* is outside
              the axes and *xycoords* is 'data'.

        pad : float, default: 0.4
            Padding around the offsetbox.

        box_alignment : (float, float)
            A tuple of two floats for a vertical and horizontal alignment of
            the offset box w.r.t. the *boxcoords*.
            The lower-left corner is (0, 0) and upper-right corner is (1, 1).

        bboxprops : dict, optional
            A dictionary of properties to set for the annotation bounding box,
            for example *boxstyle* and *alpha*.  See `.FancyBboxPatch` for
            details.

        arrowprops: dict, optional
            Arrow properties, see `.Annotation` for description.

        fontsize: float or str, optional
            Translated to points and passed as *mutation_scale* into
            `.FancyBboxPatch` to scale attributes of the box style (e.g. pad
            or rounding_size).  The name is chosen in analogy to `.Text` where
            *fontsize* defines the mutation scale as well.  If not given,
            :rc:`legend.fontsize` is used.  See `.Text.set_fontsize` for valid
            values.

        **kwargs
            Other `AnnotationBbox` properties.  See `.AnnotationBbox.set` for
            a list.
        )r��annotation_clipN�relpos�rBrBr�r�r*r�T)rjrnrDr�r�r�r�r��squarer�)rK)rrr1)rZr[rMr�_AnnotationBase�	offsetbox�copy�
arrowprops�set_fontsize�xybox�	boxcoords�_box_alignment�pop�
_arrow_relposr�arrow_patchrrcrfr��set_boxstyler�rN)rRr�rjr�r�r�rgr�r��
box_alignment�	bboxpropsr�r�rs              rrMzAnnotationBbox.__init__�sC��`	������%�
���&�&��"�x��	'�	J�#���/9�/E�*�/�/�+�4������(�#�#�/�U�R��
�&/�&;�����+����!�!%���!4�!4�X�z�!J�D��.� B�15��� B�D��"&�D��#�D��#���B��S��9�9�7�7�9���
��
�	
�
�
����c��2���D�J�J�N�N�'�Y�'����f�%rc��|jSr)r�r{s r�xyannzAnnotationBbox.xyannks���z�z�rc� �||_d|_yr�)r�rh)rRr�s  rr�zAnnotationBbox.xyannos����
���
rc��|jSr)r�r{s r�	anncoordszAnnotationBbox.anncoordstr|rc� �||_d|_yr�)r�rh)rR�coordss  rr�zAnnotationBbox.anncoordsxs�������
rc��|j|�\}}|�||fS|jd�sdifS|jj|�Sr�)r`�	_check_xyr�ra)rRrbrcrds    rrazAnnotationBbox.contains}sQ���-�-�j�9�������4�<���~�~�d�#��"�9���~�~�&�&�z�2�2rc��|j|jg}|jr|j|j�|Sr)r�r�r�r)rRr�s  rrVzAnnotationBbox.get_children�s4���N�N�D�J�J�/������O�O�D�,�,�-��rc���|j�|jj|�|jj|�tjj||�yr)r�rUr�rZr[)rRrWs  rrUzAnnotationBbox.set_figure�sH�����'����'�'��,����!�!�#�&����!�!�$��,rc�^�|�tjd}t|��|_d|_y)zk
        Set the fontsize in points.

        If *s* is not given, reset to :rc:`legend.fontsize`.
        NrYrZT)rarbrrcrhrs  rr�zAnnotationBbox.set_fontsize�s+��
�9����.�/�A�"��*��	���
rc�6�|jj�S)zReturn the fontsize in points.)rcrfr{s r�get_fontsizezAnnotationBbox.get_fontsize�s���y�y�+�+�-�-rc���|�|jj�}tj|j	�D�cgc]}|j|���c}�Scc}wr)r�r�r
rErVr��rRrqr�s   rr�z AnnotationBbox.get_window_extent�sZ�����{�{�0�0�2�H��z�z�(,�(9�(9�(;�=�$�!�2�2�8�<�=�>�	>��=s�Ac��tj|j�D�cgc]}|j|���c}�Scc}wr)r
rErV�
get_tightbboxr�s   rr�zAnnotationBbox.get_tightbbox�sB���z�z�(,�(9�(9�(;�=�$�!�.�.�x�8�=�>�	>��=s�Ac��|j\}}t|jt�rB|j\}}|j	||||�\}}|j	||||�\}}	||	}}
n!|j	||||j�\}
}|j
j
|�\}}
}}|j\}}|j
j|
||zz
|z|||
zz
|zf�|j
j|�}|jj|j�|j|j��}|jj|�|j r�|j"|j$|j&zz}|j)|�}|j*j-||�d|j vr|j|j d�}|j*j|�|j j/d|j�}|j*j1|�yy)zY
        Update pixel positions for the annotated point, the text and the arrow.
        r��patchAN)r�r�r��tuple�_get_xyr�r�r�rkr�r�r�r�r�r�r�r�r�r.r��_get_position_xyr��
set_positions�get�
set_patchA)rRrq�x�y�xcoord�ycoord�x1�y1�x2�y2�ox0�oy0r*r4r�r��fw�fhr�r��arrow_begin�	arrow_endr�s                       r�update_positionszAnnotationBbox.update_positions�s���
�z�z���1��d�n�n�e�,�!�^�^�N�F�F��\�\�(�A�q�&�9�F�B���\�\�(�A�q�&�9�F�B���2��C��|�|�H�a��D�N�N�C�H�C���~�~�0�0��:���1�b�"��$�$���B����!�!�3��a��<�"�#4�c�B��F�l�R�6G�"H�I��~�~�/�/��9���
�
���d�k�k�*�!�2�2�4�3D�3D�3F�G���
�
�%�%�n�5��?�?�
�'�'�D�I�I��0B�0B�$B�B�K��-�-�h�7�I�
���*�*�;�	�B��4�?�?�2�!)�!:�!:��O�O�$4�5�"7��
���/�/��?��_�_�(�(��4�:�:�>�F����'�'��/�'rc��|�||_|j�r|j|�sy|j|�|j�X|jj
�'|j
�|j
|j_|jj
|�|jj
|�|jj
|�d|_	yr�)
�	_rendererrxr�r�r�r�r�r�r�rhrs  rr�zAnnotationBbox.draw�s�����%�D�N����!�����)A�����h�'����'����&�&�.�4�;�;�3J�*.�+�+�� � �'����!�!�(�+��
�
����!������H�%���
r)
Nr�NTr�Nr�NNNr)r�r�r�r�r�r�r�dedent_interpdrr�rMrr�r�r�rarVrUr�r�r�r�r�r�r1rrr�r��s�����F�B�����T���E�
�3�� ��#&�!%�)�� ��l&�4��l&�\�����\�\��������������3��-�
�.�>�>�
+0�Z
rr�c�H�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)
�
DraggableBasea�
    Helper base class for a draggable artist (legend, offsetbox).

    Derived classes must override the following methods::

        def save_offset(self):
            '''
            Called when the object is picked for dragging; should save the
            reference position of the artist.
            '''

        def update_offset(self, dx, dy):
            '''
            Called during the dragging; (*dx*, *dy*) is the pixel offset from
            the point where the mouse drag started.
            '''

    Optionally, you may override the following method::

        def finalize_offset(self):
            '''Called when the mouse is released.'''

    In the current implementation of `.DraggableLegend` and
    `DraggableAnnotation`, `update_offset` places the artists in display
    coordinates, and `finalize_offset` recalculates their position in axes
    coordinate and set a relevant attribute.
    c��||_|j�s|jd�d|_|jjj
|_|xr|j
j|_|j
jjd|j�|j
jjd|j�g|_y)NTF�
pick_event�button_release_event)
�
ref_artist�pickable�
set_picker�
got_artistr��canvas�
supports_blit�	_use_blit�	callbacks�_connect_picklable�on_pick�
on_release�cids)rRr�use_blits   rrMzDraggableBase.__init__s���$����"�"�$��!�!�$�'�����o�o�,�,�3�3���!�?�d�k�k�&?�&?����K�K�!�!�4�4��d�l�l�
,��K�K�!�!�4�4�&����
9�
��	rc��|j�r�|jr�|j|jz
}|j|j
z
}|j
||�|jr}|jj|j�|jj|jjj��|jj�y|jj�yyyr)�_check_still_parentedrr��mouse_xr��mouse_y�
update_offsetrr�restore_region�
backgroundrr�r�r��blit)rR�evt�dx�dys    r�	on_motionzDraggableBase.on_motions����%�%�'�D�O�O�������%�B�������%�B����r�2�&��~�~����*�*�4�?�?�;����$�$��O�O�*�*�8�8�:�<���� � �"���� � �"�-<�'rc��|j��rt|j|jk(�rY|jj|_|jj|_d|_|jr�|jjd�|jj�|jj|jjj�|_|jj|jjj#��|jj%�|jj&j)d|j*�|_|j/�yyy)NT�motion_notify_event)r�artistrrbr�rr�rrr�set_animatedrr��copy_from_bboxr�r�rr�rrrr �_c1�save_offset)rRrs  rrzDraggableBase.on_pick#s
���%�%�'�C�J�J�$�/�/�,I��>�>�+�+�D�L��>�>�+�+�D�L�"�D�O��~�~����,�,�T�2���� � �"��K�K�.�.�t���/E�/E�/J�/J�K������$�$��O�O�*�*�8�8�:�<���� � �"��{�{�,�,�?�?�%�t�~�~�7�D�H�����-J�'rc��|j�rr|jre|j�d|_|jj	|j
�|jr|jjd�yyyyr�)	rr�finalize_offsetr�mpl_disconnectr&rrr$)rR�events  rrzDraggableBase.on_release4sc���%�%�'�D�O�O�� � �"�#�D�O��K�K�&�&�t�x�x�0��~�~����,�,�U�3��-<�'rc�R�|jj�|j�yy)NFT)rr��
disconnectr{s rrz#DraggableBase._check_still_parented=s"���?�?�!�!�)��O�O���rc���|jD]}|jj|��	|j}|jj|�y#t$rYywxYw)zDisconnect the callbacks.N)rrr*r&�AttributeError)rR�cid�c1s   rr-zDraggableBase.disconnectDs]���9�9�	,�C��K�K�&�&�s�+�	,�	+����B�
�K�K�&�&�r�*���	��	�s�A�	A"�!A"c��yrr1r{s rr'zDraggableBase.save_offsetO���rc��yrr1)rRrrs   rrzDraggableBase.update_offsetRr3rc��yrr1r{s rr)zDraggableBase.finalize_offsetUr3rN�F)
r�r�r�r�rMr rrrr-r'rr)r1rrrr�s4���8
�#��"4��	+�
�
�
rrc�2��eZdZd�fd�	Zd�Zd�Zd�Z�xZS)�DraggableOffsetBoxc�6��t�|�||��||_y�N)r)rLrMr�)rRrr�rrSs    �rrMzDraggableOffsetBox.__init__Zs���
����h��7�"��rc��|j}|jj�}|j|�\}}}}|j	|||||�}|\|_|_|jj|�yr)r�r�r�r�rr�offsetbox_x�offsetbox_yrk)rRr�rqr*r4r�r��offsets        rr'zDraggableOffsetBox.save_offset^sq���N�N�	��#�#�1�1�3�� �+�+�H�5���1�b�"��%�%�a��B��H�=��-3�*���$�*����!�!�&�)rc�v�|j|z|j|zf}|jj|�yr)r<r=r�rk)rRrr�
loc_in_canvass    rrz DraggableOffsetBox.update_offsetfs4���(�(�2�-�t�/?�/?�"�/D�D�
����!�!�-�0rc��|j}|jj�}|j|�\}}}}|j\}}||z
||z
f}	|	Sr)r�r�r�r�rQ)
rRr�rqr*r4r�r�r�r�r@s
          r�get_loc_in_canvasz$DraggableOffsetBox.get_loc_in_canvasjs^���N�N�	��#�#�1�1�3�� �+�+�H�5���1�b�"��"�"���B��b��"�r�'�*�
��rr6)r�r�r�rMr'rrBr�r�s@rr8r8Ys���#�*�1�rr8c�,��eZdZd�fd�	Zd�Zd�Z�xZS)�DraggableAnnotationc�6��t�|�||��||_yr:)rLrM�
annotation)rRrFrrSs   �rrMzDraggableAnnotation.__init__ts���
����h��7�$��rc��|j}|j�j|j�\|_|_yr)rFr�rtr�r�r�)rR�anns  rr'zDraggableAnnotation.save_offsetxs1���o�o���,�,�.�8�8����C�����rc��|j}|j�j�j|j|z|j
|zf�|_yr)rFr��invertedrtr�r�r�)rRrrrHs    rrz!DraggableAnnotation.update_offset|sG���o�o���%�%�'�0�0�2�<�<�
�W�W�r�\�4�7�7�R�<�(�*��	rr6)r�r�r�rMr'rr�r�s@rrDrDss���%�D�*rrD)r)r8)4r��numpyr�
matplotlibrarr�matplotlib.artistr#rZ�matplotlib.path�pathr�matplotlib.text�textr�matplotlib.transforms�
transformsr��matplotlib.font_managerr�matplotlib.imager�matplotlib.patchesrrr	rr
rrrr.rGr[rIr�r�r�r�r�rr9rNr~r�r�r�r�rr8rDr1rr�<module>rWs9���0��'�#���+�2�&�B�B�A�A�	��&�
R�j1$�hv����v�r,"��,"�^&/�j�&/�R#/�j�#/�LE"�	�E"�Pu�)�u�p�y��DX�i�X�vO�	�O�d	4�)�$�)�XR�)�R�j{�W�^�^�U�%:�%:�{�|k
�k
�\���4*�-�*r

Youez - 2016 - github.com/yon3zu
LinuXploit