403Webshell
Server IP : 202.61.199.114  /  Your IP : 216.73.217.139
Web Server : nginx/1.22.1
System : Linux de.arni-solutions.de 6.1.0-49-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.174-1 (2026-05-26) x86_64
User : web20 ( 1018)
PHP Version : 8.4.23
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/local/lib/python3.9/dist-packages/matplotlib/__pycache__/gridspec.cpython-39.pyc
a

���hEt�@s�dZddlZddlZddlmZddlZddlZddlm	Z	m
Z
mZddlm
Z
e�e�ZGdd�d�ZGdd	�d	e�ZGd
d�de�ZGdd
�d
�ZGdd�d�ZdS)a�
:mod:`~matplotlib.gridspec` contains classes that help to layout multiple
`~.axes.Axes` in a grid-like pattern within a figure.

The `GridSpec` specifies the overall grid structure. Individual cells within
the grid are referenced by `SubplotSpec`\s.

Often, users need not access this module directly, and can use higher-level
methods like `~.pyplot.subplots`, `~.pyplot.subplot_mosaic` and
`~.Figure.subfigures`. See the tutorial :ref:`arranging_axes` for a guide.
�N)�Integral)�_api�_pylab_helpers�
_tight_layout)�Bboxc@s�eZdZdZd'dd�Zdd�Zedd�d	d
�Zedd�dd
�Zd
d�Z	d(dd�Z
d)dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zedd��Zd d!�Zd"d"d#dd$�d%d&�ZdS)*�GridSpecBasezm
    A base class of GridSpec that specifies the geometry of the grid
    that a subplot will be placed.
    NcCsft|t�r|dkr td|����t|t�r2|dkr@td|����|||_|_|�|�|�|�dS)a�
        Parameters
        ----------
        nrows, ncols : int
            The number of rows and columns of the grid.
        width_ratios : array-like of length *ncols*, optional
            Defines the relative widths of the columns. Each column gets a
            relative width of ``width_ratios[i] / sum(width_ratios)``.
            If not given, all columns will have the same width.
        height_ratios : array-like of length *nrows*, optional
            Defines the relative heights of the rows. Each row gets a
            relative height of ``height_ratios[i] / sum(height_ratios)``.
            If not given, all rows will have the same height.
        rz/Number of rows must be a positive integer, not z2Number of columns must be a positive integer, not N)�
isinstancer�
ValueError�_nrows�_ncols�set_height_ratios�set_width_ratios)�self�nrows�ncols�
height_ratios�width_ratios�r�=/usr/local/lib/python3.9/dist-packages/matplotlib/gridspec.py�__init__ s��
zGridSpecBase.__init__cCsbtt|j��dkrd|j��nd}tt|j��dkr@d|j��nd}dj|jj|j|j||d�S)N�z, height_ratios=�z, width_ratios=z&{clsname}({nrows}, {ncols}{optionals}))Zclsnamerr�	optionals)	�len�set�_row_height_ratios�_col_width_ratios�format�	__class__�__name__r
r)rZ
height_argZ	width_argrrr�__repr__9s�����zGridSpecBase.__repr__cCs|jS�N)r
�rrrr�<lambda>E�zGridSpecBase.<lambda>zThe number of rows in the grid.)�doccCs|jSr!)rr"rrrr#Gr$z"The number of columns in the grid.cCs|j|jfS)zW
        Return a tuple containing the number of rows and columns in the grid.
        )r
rr"rrr�get_geometryJszGridSpecBase.get_geometrycCsdSr!r)r�figurerrr�get_subplot_paramsPszGridSpecBase.get_subplot_paramsrcCs(|\}}||||�|||�f}|S)a[
        Create and return a `.SubplotSpec` instance.

        Parameters
        ----------
        loc : (int, int)
            The position of the subplot in the grid as
            ``(row_index, column_index)``.
        rowspan, colspan : int, default: 1
            The number of rows and columns the subplot should span in the grid.
        r)r�loc�rowspan�colspan�loc1�loc2Zsubplotspecrrr�new_subplotspecTszGridSpecBase.new_subplotspeccCs6|durdg|j}nt|�|jkr,td��||_dS)z�
        Set the relative widths of the columns.

        *width_ratios* must be of length *ncols*. Each column gets a relative
        width of ``width_ratios[i] / sum(width_ratios)``.
        NrzTExpected the given number of width ratios to match the number of columns of the grid)rrr	r)rrrrrr
ds
zGridSpecBase.set_width_ratioscCs|jS)zo
        Return the width ratios.

        This is *None* if no width ratios have been set explicitly.
        )rr"rrr�get_width_ratiosrszGridSpecBase.get_width_ratioscCs6|durdg|j}nt|�|jkr,td��||_dS)z�
        Set the relative heights of the rows.

        *height_ratios* must be of length *nrows*. Each row gets a relative
        height of ``height_ratios[i] / sum(height_ratios)``.
        NrzRExpected the given number of height ratios to match the number of rows of the grid)r
rr	r)rrrrrrzs
zGridSpecBase.set_height_ratioscCs|jS)zq
        Return the height ratios.

        This is *None* if no height ratios have been set explicitly.
        )rr"rrr�get_height_ratios�szGridSpecBase.get_height_ratioscsV|��\}}|�|�}|j}|j}|j}|j}|j}	|j}
||}||}|||
|d}
|
|
}|
|t|j	���fdd�|j	D�}dg|g|d}t
�t
�||g�j
�}|||	|d}|	|}||t|j���fdd�|jD�}dg|g|d}t
�t
�||g�j
�}||�d�j\}}||�d�j\}}||||fS)a�
        Return the positions of the grid cells in figure coordinates.

        Parameters
        ----------
        fig : `~matplotlib.figure.Figure`
            The figure the grid should be applied to. The subplot parameters
            (margins and spacing between subplots) are taken from *fig*.

        Returns
        -------
        bottoms, tops, lefts, rights : array
            The bottom, top, left, right positions of the grid cells in
            figure coordinates.
        rcsg|]}|��qSrr��.0�r�Znormrr�
<listcomp>�r$z3GridSpecBase.get_grid_positions.<locals>.<listcomp>rcsg|]}|��qSrrr1r4rrr5�r$)����)r&r(�left�right�bottom�top�wspace�hspace�sumr�npZcumsumZcolumn_stack�flatrZreshape�T)rZfigrrZsubplot_paramsr8r9r:r;r<r=Z	tot_widthZ
tot_heightZcell_hZsep_hZcell_heightsZsep_heightsZcell_hsZcell_wZsep_wZcell_widthsZ
sep_widthsZcell_ws�fig_tops�fig_bottoms�	fig_lefts�
fig_rightsrr4r�get_grid_positions�s2
zGridSpecBase.get_grid_positionscCsZ|��D]B}|��}|durt|d�r2|����}|��||fkr|Sqt|||d�S)zo
        Check if the figure already has a gridspec with these dimensions,
        or create a new one
        N�get_topmost_subplotspec�r')Zget_axes�get_gridspec�hasattrrGr&�GridSpec)r'rr�ax�gsrrr�_check_gridspec_exists�s

z#GridSpecBase._check_gridspec_existsc

Cs�|��\}}dd�}t|t�r�z|\}}Wn.tyX}ztd�|�WYd}~n
d}~00t�|||d�|||d�g||f�\}}	n||||d�\}}	t|||	�S)z,Create and return a `.SubplotSpec` instance.cSs�|}t|t�r<|�|�\}}}||kr2||dfStd��nh|dkrL||}d|kr`|krlnn||fS|dur�td|�d|�d|����ntd|�d|����dS)Nrz=GridSpec slice would result in no space allocated for subplotrzindex z is out of bounds for axis z with size z) is out of bounds for GridSpec with size )r�slice�indices�
IndexError)�key�sizeZaxisZorig_key�start�stop�_rrr�
_normalize�s&


��

�z,GridSpecBase.__getitem__.<locals>._normalizezUnrecognized subplot specNrr)r&r�tupler	r?Zravel_multi_index�SubplotSpec)
rrRrrrWZk1Zk2�err�num1�num2rrr�__getitem__�s
 �
zGridSpecBase.__getitem__FT)�sharex�sharey�squeeze�
subplot_kwcCsn|j}|durtd��t|t�s,|r(dnd}t|t�sB|r>dnd}tjgd�||d�|durbi}|��}tj|j	|j
ftd�}t|j	�D]p}t|j
�D]`}d|d||d	f|d	|fd
�}	|	||d<|	||d<|j
|||ffi|��|||f<q�q�|d
v�r |jD]}
|
jdd��q|dv�rD|jD]}
|
jdd��q0|�rf|jdk�r^|��S|��S|SdS)z�
        Add all subplots specified by this `GridSpec` to its parent figure.

        See `.Figure.subplots` for detailed documentation.
        NzIGridSpec.subplots() only works for GridSpecs created with a parent figure�all�none)rb�row�colrcFT)r^r_)Zdtype)rrr)rcrbrdrer^r_)rerbT)Zskip_non_rectangular_axes)rdrbr)r'r	r�strrZ
check_in_list�copyr?�emptyr
r�object�rangeZadd_subplotr@Z_label_outer_xaxisZ_label_outer_yaxisrS�itemr`)rr^r_r`rar'ZaxarrrdreZshared_withrLrrr�subplots�sF


��
��



zGridSpecBase.subplots)NN)N)rr)r�
__module__�__qualname__�__doc__rr �propertyrrr&r(r.r
r/rr0rF�staticmethodrNr]rlrrrrrs.
��

/
%�rc	sNeZdZdZd�fdd�	Zgd�Zdd�Zddd	�Zd
d�Zdd
d�Z	�Z
S)rKa
    A grid layout to place subplots within a figure.

    The location of the grid cells is determined in a similar way to
    `.SubplotParams` using *left*, *right*, *top*, *bottom*, *wspace*
    and *hspace*.

    Indexing a GridSpec instance returns a `.SubplotSpec`.
    NcsB||_||_||_||_||_|	|_||_t�j|||
|d�dS)a�
        Parameters
        ----------
        nrows, ncols : int
            The number of rows and columns of the grid.

        figure : `.Figure`, optional
            Only used for constrained layout to create a proper layoutgrid.

        left, right, top, bottom : float, optional
            Extent of the subplots as a fraction of figure width or height.
            Left cannot be larger than right, and bottom cannot be larger than
            top. If not given, the values will be inferred from a figure or
            rcParams at draw time. See also `GridSpec.get_subplot_params`.

        wspace : float, optional
            The amount of width reserved for space between subplots,
            expressed as a fraction of the average axis width.
            If not given, the values will be inferred from a figure or
            rcParams when necessary. See also `GridSpec.get_subplot_params`.

        hspace : float, optional
            The amount of height reserved for space between subplots,
            expressed as a fraction of the average axis height.
            If not given, the values will be inferred from a figure or
            rcParams when necessary. See also `GridSpec.get_subplot_params`.

        width_ratios : array-like of length *ncols*, optional
            Defines the relative widths of the columns. Each column gets a
            relative width of ``width_ratios[i] / sum(width_ratios)``.
            If not given, all columns will have the same width.

        height_ratios : array-like of length *nrows*, optional
            Defines the relative heights of the rows. Each row gets a
            relative height of ``height_ratios[i] / sum(height_ratios)``.
            If not given, all rows will have the same height.

        �rrN)	r8r:r9r;r<r=r'�superr)rrrr'r8r:r9r;r<r=rr�rrrr9s*
�zGridSpec.__init__�r8r:r9r;r<r=cKs�|��D].\}}||jvr(t|||�qt|�d���qtjj��D]N}|jj	j
D]>}|��durR|����}|�
�|krR|�|���|j	��qRqDdS)a
        Update the subplot parameters of the grid.

        Parameters that are not explicitly given are not changed. Setting a
        parameter to *None* resets it to :rc:`figure.subplot.*`.

        Parameters
        ----------
        left, right, top, bottom : float or None, optional
            Extent of the subplots as a fraction of figure width or height.
        wspace, hspace : float, optional
            Spacing between the subplots as a fraction of the average subplot
            width / height.
        z is an unknown keywordN)�items�_AllowedKeys�setattr�AttributeErrorrZGcfZfigs�valuesZcanvasr'�axesZget_subplotspecrGrIZ
_set_position�get_position)r�kwargs�k�vZ
figmanagerrL�ssrrr�updateqs
�zGridSpec.updatecsX|dur(dd��jD�}tfi|��}nt�|j�}|jfi�fdd��jD���|S)a:
        Return the `.SubplotParams` for the GridSpec.

        In order of precedence the values are taken from

        - non-*None* attributes of the GridSpec
        - the provided *figure*
        - :rc:`figure.subplot.*`

        Note that the ``figure`` attribute of the GridSpec is always ignored.
        NcSsi|]}|tjd|�qS)�figure.subplot.)�mpl�rcParams�r2r~rrr�
<dictcomp>�s�z/GridSpec.get_subplot_params.<locals>.<dictcomp>csi|]}|t�|��qSr��getattrr�r"rrr��r$)rw�
SubplotParamsrg�subplotparsr�)rr'�kwr�rr"rr(�s� zGridSpec.get_subplot_paramscs�fdd��jD�S)z�
        Return a list of the names of the subplot parameters explicitly set
        in the GridSpec.

        This is a subset of the attributes of `.SubplotParams`.
        csg|]}t�|�r|�qSrr�r�r"rrr5�r$z<GridSpec.locally_modified_subplot_params.<locals>.<listcomp>)rwr"rr"r�locally_modified_subplot_params�sz(GridSpec.locally_modified_subplot_params�H�z�G�?c
CsP|dur|��}tj||jtj|j|d�|||||d�}|rL|jfi|��dS)a
        Adjust subplot parameters to give specified padding.

        Parameters
        ----------
        figure : `.Figure`
            The figure.
        renderer :  `.RendererBase` subclass, optional
            The renderer to be used.
        pad : float
            Padding between the figure edge and the edges of subplots, as a
            fraction of the font-size.
        h_pad, w_pad : float, optional
            Padding (height/width) between edges of adjacent subplots.
            Defaults to *pad*.
        rect : tuple (left, bottom, right, top), default: None
            (left, bottom, right, top) rectangle in normalized figure
            coordinates that the whole subplots area (including labels) will
            fit into. Default (None) is the whole figure.
        N)Z	grid_spec)�pad�h_pad�w_pad�rect)Z
_get_rendererrZget_tight_layout_figurer{Zget_subplotspec_listr�)rr'Zrendererr�r�r�r�r}rrr�tight_layout�s
�zGridSpec.tight_layout)	NNNNNNNNN)N)Nr�NNN)rrmrnrorrwr�r(r�r��
__classcell__rrrtrrK/s	�6
	�rKcs4eZdZdZd	�fdd�	Zd
dd�Zdd�Z�ZS)�GridSpecFromSubplotSpeczx
    GridSpec whose subplot layout parameters are inherited from the
    location specified by a given SubplotSpec.
    NcsL||_||_t|t�r||_ntd��|j��j|_t�j	||||d�dS)ak
        Parameters
        ----------
        nrows, ncols : int
            Number of rows and number of columns of the grid.
        subplot_spec : SubplotSpec
            Spec from which the layout parameters are inherited.
        wspace, hspace : float, optional
            See `GridSpec` for more details. If not specified default values
            (from the figure or rcParams) are used.
        height_ratios : array-like of length *nrows*, optional
            See `GridSpecBase` for details.
        width_ratios : array-like of length *ncols*, optional
            See `GridSpecBase` for details.
        zVsubplot_spec must be type SubplotSpec, usually from GridSpec, or axes.get_subplotspec.rrN)
�_wspace�_hspacerrY�
_subplot_spec�	TypeErrorrIr'rsr)rrrZsubplot_specr<r=rrrtrrr�s
�
�z GridSpecFromSubplotSpec.__init__c	Cs�|jdur|jn|dur |jjntjd}|jdur:|jn|durJ|jjntjd}|j�|�}|j	\}}}}t
||||||d�S)z1Return a dictionary of subplot layout parameters.Nzfigure.subplot.hspacezfigure.subplot.wspace)r8r9r:r;r<r=)r�r�r=r�r�r�r<r�r|Zextentsr�)	rr'r=r<Zfigboxr8r:r9r;rrrr(�s���z*GridSpecFromSubplotSpec.get_subplot_paramscCs
|j��S)zY
        Return the topmost `.SubplotSpec` instance associated with the subplot.
        )r�rGr"rrrrGsz/GridSpecFromSubplotSpec.get_topmost_subplotspec)NNNN)N)rrmrnrorr(rGr�rrrtrr��s� 
r�c@s�eZdZdZd&dd�Zdd�Zedd��Zed	d
��Z	e	j
dd
��Z	dd
�Zdd�Zedd��Z
edd��Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�ZdS)'rYa]
    The location of a subplot in a `GridSpec`.

    .. note::

        Likely, you will never instantiate a `SubplotSpec` yourself. Instead,
        you will typically obtain one from a `GridSpec` using item-access.

    Parameters
    ----------
    gridspec : `~matplotlib.gridspec.GridSpec`
        The GridSpec, which the subplot is referencing.
    num1, num2 : int
        The subplot will occupy the *num1*-th cell of the given
        *gridspec*.  If *num2* is provided, the subplot will span between
        *num1*-th cell and *num2*-th cell **inclusive**.

        The index starts from 0.
    NcCs||_||_||_dSr!)�	_gridspecr[r\)r�gridspecr[r\rrrrszSubplotSpec.__init__c
Cs6|���d|jj�d|jj�d|jj�d|jj�d�
S)N�[�:z, �])rIr*rTrUr+r"rrrr "s
����zSubplotSpec.__repr__c	Cs`t|�dkrv|\}t|t�r |St|t�s8td|����zttt|��\}}}Wq�tyrtd|���d�Yq�0n,t|�dkr�|\}}}ntj	ddt|�d��t
�|||�}|dur�t
|||d�}t|t��rt|�d	k�rt
d
d�|D���std|����|\}}nDt|t��r0|dk�s0|||k�rHtd
||�d|����|}}||d|�S)z�
        Construct a `.SubplotSpec` from a parent `.Figure` and either

        - a `.SubplotSpec` -- returned as is;
        - one or three numbers -- a MATLAB-style subplot specifier.
        rz>Single argument to subplot must be a three-digit integer, not N�Zsubplotz1 or 3)Ztakes�givenrHr7css|]}t|t�VqdSr!)rr)r2�nrrr�	<genexpr>Fr$z1SubplotSpec._from_subplot_args.<locals>.<genexpr>z3Subplot specifier tuple must contain integers, not z(num must be an integer with 1 <= num <= z, not )rrrYrr	�map�intrfrZnargs_errorrKrNrXrb)	r'�args�arg�rows�cols�numrM�i�jrrr�_from_subplot_args'sP

�����
�
$��zSubplotSpec._from_subplot_argscCs|jdur|jS|jSr!)�_num2r[r"rrrr\WszSubplotSpec.num2cCs
||_dSr!)r�)r�valuerrrr\[scCs|jSr!)r�r"rrrrI_szSubplotSpec.get_gridspeccCs |����\}}|||j|jfS)a
        Return the subplot geometry as tuple ``(n_rows, n_cols, start, stop)``.

        The indices *start* and *stop* define the range of the subplot within
        the `GridSpec`. *stop* is inclusive (i.e. for a single cell
        ``start == stop``).
        )rIr&r[r\)rr�r�rrrr&bszSubplotSpec.get_geometrycCs$|��j}t|j||j|d�S)z6The rows spanned by this subplot, as a `range` object.r)rIrrjr[r\)rrrrrr*ms
zSubplotSpec.rowspancCs4|��j}t|j||j|g�\}}t||d�S)z9The columns spanned by this subplot, as a `range` object.r)rIr�sortedr[r\rj)rrZc1�c2rrrr+ss
zSubplotSpec.colspancCs|jjdkS�Nr)r*rTr"rrr�is_first_row|szSubplotSpec.is_first_rowcCs|jj|��jkSr!)r*rUrIrr"rrr�is_last_rowszSubplotSpec.is_last_rowcCs|jjdkSr�)r+rTr"rrr�is_first_col�szSubplotSpec.is_first_colcCs|jj|��jkSr!)r+rUrIrr"rrr�is_last_col�szSubplotSpec.is_last_colcCs�|��}|��\}}t�|j|jg||f�\}}|�|�\}}}	}
||��}||��}|	|��}
|
|��}t	�
|
|||�S)zJ
        Update the subplot position from ``figure.subplotpars``.
        )rIr&r?Z
unravel_indexr[r\rF�min�maxrZfrom_extents)rr'r�rrr�r�rCrBrDrEZ
fig_bottomZfig_topZfig_leftZ	fig_rightrrrr|�s�
zSubplotSpec.get_positioncCs"|��}t|d�r|��S|SdS)zX
        Return the topmost `SubplotSpec` instance associated with the subplot.
        rGN)rIrJrG)rr�rrrrG�s
z#SubplotSpec.get_topmost_subplotspeccCs8|j|j|jft|dt��t|dt��t|dt��fkS)z}
        Two SubplotSpecs are considered equal if they refer to the same
        position(s) in the same `GridSpec`.
        r�r[r\)r�r[r\r�ri)r�otherrrr�__eq__�s��zSubplotSpec.__eq__cCst|j|j|jf�Sr!)�hashr�r[r\r"rrr�__hash__�szSubplotSpec.__hash__cKst|||fi|��S)a�
        Create a GridSpec within this subplot.

        The created `.GridSpecFromSubplotSpec` will have this `SubplotSpec` as
        a parent.

        Parameters
        ----------
        nrows : int
            Number of rows in grid.

        ncols : int
            Number of columns in grid.

        Returns
        -------
        `.GridSpecFromSubplotSpec`

        Other Parameters
        ----------------
        **kwargs
            All other parameters are passed to `.GridSpecFromSubplotSpec`.

        See Also
        --------
        matplotlib.pyplot.subplots

        Examples
        --------
        Adding three subplots in the space occupied by a single subplot::

            fig = plt.figure()
            gs0 = fig.add_gridspec(3, 1)
            ax1 = fig.add_subplot(gs0[0])
            ax2 = fig.add_subplot(gs0[1])
            gssub = gs0[2].subgridspec(1, 3)
            for i in range(3):
                fig.add_subplot(gssub[0, i])
        )r�)rrrr}rrr�subgridspec�s(zSubplotSpec.subgridspec)N)rrmrnrorr rqr�rpr\�setterrIr&r*r+r�r�r�r�r|rGr�r�r�rrrrrY	s0

/




rYc@s$eZdZdZddd�Zddd�ZdS)	r�zM
    Parameters defining the positioning of a subplots grid in a figure.
    NcCs:dD]}t||tjd|���q|�||||||�dS)au
        Defaults are given by :rc:`figure.subplot.[name]`.

        Parameters
        ----------
        left : float
            The position of the left edge of the subplots,
            as a fraction of the figure width.
        right : float
            The position of the right edge of the subplots,
            as a fraction of the figure width.
        bottom : float
            The position of the bottom edge of the subplots,
            as a fraction of the figure height.
        top : float
            The position of the top edge of the subplots,
            as a fraction of the figure height.
        wspace : float
            The width of the padding between subplots,
            as a fraction of the average Axes width.
        hspace : float
            The height of the padding between subplots,
            as a fraction of the average Axes height.
        rur�N)rxr�r�r�)rr8r:r9r;r<r=rRrrrr�szSubplotParams.__init__cCs�|dur|n|j|dur|n|jkr,td��|dur8|n|j|durH|n|jkrXtd��|durf||_|durt||_|dur�||_|dur�||_|dur�||_|dur�||_dS)zY
        Update the dimensions of the passed parameters. *None* means unchanged.
        Nzleft cannot be >= rightzbottom cannot be >= top)r8r9r	r:r;r<r=)rr8r:r9r;r<r=rrrr��s(��zSubplotParams.update)NNNNNN)NNNNNN)rrmrnrorr�rrrrr��s�
�r�)rorg�logging�numbersr�numpyr?Z
matplotlibr�rrrZmatplotlib.transformsr�	getLoggerr�_logrrKr�rYr�rrrr�<module>s"
<S

Youez - 2016 - github.com/yon3zu
LinuXploit