§
    õŽ’jXz  ã                   ó  — d Z ddlZddlZddlmZ ddlZddlZddlm	Z	m
Z
mZ ddlmZ ddlmZ  ej        e¦  «        Z G d„ d¦  «        Z G d	„ d
e¦  «        Z G d„ de¦  «        Z G d„ d¦  «        Z G d„ d¦  «        ZdS )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)ÚUNSET)ÚBboxc                   óº   — e Zd ZdZdd„Zd„ Z ed„ d¬¦  «        Z ed„ d	¬¦  «        Zd
„ Z	dd„Z
dd„Zd„ Zd„ Zd„ Zd„ Zd„ Zed„ ¦   «         Zd„ Zdddddœd„ZdS )ÚGridSpecBasezm
    A base class of GridSpec that specifies the geometry of the grid
    that a subplot will be placed.
    Nc                 ó,  — t          |t          ¦  «        r|dk    rt          d|›�¦  «        ‚t          |t          ¦  «        r|dk    rt          d|›�¦  «        ‚||c| _        | _        |                      |¦  «         |                      |¦  «         dS )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.
        r   z/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_ratioss        úAC:\Projects\DSCons\.venv\Lib\site-packages\matplotlib\gridspec.pyÚ__init__zGridSpecBase.__init__!   s¸   € õ ˜%¥Ñ*Ô*ð 	M¨e°qªj¨jÝØKÀ%ÐKÐKñMô Mð Må˜%¥Ñ*Ô*ð 	P¨e°qªj¨jÝØNÀUÐNÐNñPô Pð Pà#(¨%Ð ˆŒ�T”[Ø×Ò˜}Ñ-Ô-Ð-Ø×Ò˜lÑ+Ô+Ð+Ð+Ð+ó    c                 ó&  — t          t          | j        ¦  «        ¦  «        dk    r
d| j        ›�nd}t          t          | j        ¦  «        ¦  «        dk    r
d| j        ›�nd}d                     | j        j        | j        | j        ||z   ¬¦  «        S )Né   z, height_ratios=Ú z, width_ratios=z&{clsname}({nrows}, {ncols}{optionals}))Úclsnamer   r   Ú	optionals)	ÚlenÚsetÚ_row_height_ratiosÚ_col_width_ratiosÚformatÚ	__class__Ú__name__r   r   )r   Ú
height_argÚ	width_args      r   Ú__repr__zGridSpecBase.__repr__:   s¯   € å�S Ô!8Ñ9Ô9Ñ:Ô:¸aÒ?Ð?ð E¨Ô)@ÐDÐDÐDØEGð 	õ �C Ô 6Ñ7Ô7Ñ8Ô8¸AÒ=Ð=ð B tÔ'=ÐAÐAÐAØCEð 	à7×>Ò>Ø”NÔ+Ø”+Ø”+Ø  9Ñ,ð	 ?ñ ô ð 	r   c                 ó   — | j         S ©N)r   ©r   s    r   ú<lambda>zGridSpecBase.<lambda>F   ó   €  $¤+€ r   zThe number of rows in the grid.)Údocc                 ó   — | j         S r*   )r   r+   s    r   r,   zGridSpecBase.<lambda>H   r-   r   z"The number of columns in the grid.c                 ó   — | j         | j        fS )zW
        Return a tuple containing the number of rows and columns in the grid.
        )r   r   r+   s    r   Úget_geometryzGridSpecBase.get_geometryK   s   € ð Œ{˜DœKÐ'Ð'r   c                 ó   — d S r*   © )r   Úfigures     r   Úget_subplot_paramszGridSpecBase.get_subplot_paramsQ   s   € àˆr   r   c                 ó8   — |\  }}| |||z   …|||z   …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.
        r3   )r   ÚlocÚrowspanÚcolspanÚloc1Úloc2Úsubplotspecs          r   Únew_subplotspeczGridSpecBase.new_subplotspecU   s4   € ð ‰
ˆˆdØ˜4  W¡Ð,¨d°4¸±<Ð.?Ð?Ô@ˆØÐr   c                 ó~   — |€dg| j         z  }n't          |¦  «        | j         k    rt          d¦  «        ‚|| _        dS )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)``.
        Nr   zTExpected the given number of width ratios to match the number of columns of the grid)r   r   r   r"   )r   r   s     r   r   zGridSpecBase.set_width_ratiose   sX   € ð ÐØ˜3 ¤Ñ,ˆLˆLÝ�ÑÔ $¤+Ò-Ð-Ýð Gñ Hô Hð Hà!-ˆÔÐÐr   c                 ó   — | j         S )zo
        Return the width ratios.

        This is *None* if no width ratios have been set explicitly.
        )r"   r+   s    r   Úget_width_ratioszGridSpecBase.get_width_ratioss   s   € ð Ô%Ð%r   c                 ó~   — |€dg| j         z  }n't          |¦  «        | j         k    rt          d¦  «        ‚|| _        dS )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)``.
        Nr   zRExpected the given number of height ratios to match the number of rows of the grid)r   r   r   r!   )r   r   s     r   r   zGridSpecBase.set_height_ratios{   sX   € ð Ð Ø˜C $¤+Ñ-ˆMˆMÝ�ÑÔ 4¤;Ò.Ð.Ýð Dñ Eô Eð Eà"/ˆÔÐÐr   c                 ó   — | j         S )zq
        Return the height ratios.

        This is *None* if no height ratios have been set explicitly.
        )r!   r+   s    r   Úget_height_ratioszGridSpecBase.get_height_ratios‰   s   € ð Ô&Ð&r   c                 ó8  ‡— |                       ¦   «         \  }}|                      |¦  «        }|j        }|j        }|j        }|j        }|j        }	|j        }
||z
  }||z
  }|||
|dz
  z  z   z  }|
|z  }||z  t          | j	        ¦  «        z  Šˆfd„| j	        D ¦   «         }dg|g|dz
  z  z   }t          j        t          j        ||g¦  «        j        ¦  «        }|||	|dz
  z  z   z  }|	|z  }||z  t          | j        ¦  «        z  Šˆfd„| j        D ¦   «         }dg|g|dz
  z  z   }t          j        t          j        ||g¦  «        j        ¦  «        }||z
                       d¦  «        j        \  }}||z                        d¦  «        j        \  }}||||fS )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.
        r   c                 ó   •— g | ]}|‰z  ‘ŒS r3   r3   ©Ú.0ÚrÚnorms     €r   ú
<listcomp>z3GridSpecBase.get_grid_positions.<locals>.<listcomp>°   s   ø€ ÐBÐBÐB Q˜˜D™ÐBÐBÐBr   r   c                 ó   •— g | ]}|‰z  ‘ŒS r3   r3   rF   s     €r   rJ   z3GridSpecBase.get_grid_positions.<locals>.<listcomp>¸   s   ø€ Ð@Ð@Ð@ A�q˜4‘xÐ@Ð@Ð@r   )éÿÿÿÿé   )r1   r5   ÚleftÚrightÚbottomÚtopÚwspaceÚhspaceÚsumr!   ÚnpÚcumsumÚcolumn_stackÚflatr"   ÚreshapeÚT)r   Úfigr   r   Úsubplot_paramsrN   rO   rP   rQ   rR   rS   Ú	tot_widthÚ
tot_heightÚcell_hÚsep_hÚcell_heightsÚsep_heightsÚcell_hsÚcell_wÚsep_wÚcell_widthsÚ
sep_widthsÚcell_wsÚfig_topsÚfig_bottomsÚ	fig_leftsÚ
fig_rightsrI   s                              @r   Úget_grid_positionszGridSpecBase.get_grid_positions‘   sÜ  ø€ ð  ×(Ò(Ñ*Ô*‰ˆˆuØ×0Ò0°Ñ5Ô5ˆØÔ"ˆØÔ$ˆØÔ&ˆØÔ ˆØÔ&ˆØÔ&ˆØ˜D‘Lˆ	Ø˜6‘\ˆ
ð ˜u v¨u°Q©wÑ'7Ñ7Ñ8ˆØ˜‘ˆØ˜‰~¥ DÔ$;Ñ <Ô <Ñ<ˆØBÐBÐBÐB¨$Ô*AÐBÑBÔBˆØ�c˜e˜W¨¨a©Ñ0Ñ1ˆÝ”)�BœO¨[¸,Ð,GÑHÔHÔMÑNÔNˆð ˜e f¨e°A©gÑ&6Ñ6Ñ7ˆØ˜‘ˆØ˜‰~¥ DÔ$:Ñ ;Ô ;Ñ;ˆØ@Ð@Ð@Ð@¨Ô)?Ð@Ñ@Ô@ˆØ�S˜U˜G u¨Q¡wÑ/Ñ0ˆ
Ý”)�BœO¨Z¸Ð,EÑFÔFÔKÑLÔLˆà!$ w¡× 7Ò 7¸Ñ @Ô @Ô BÑˆ�+Ø!%¨¡× 8Ò 8¸Ñ AÔ AÔ CÑˆ	�:Ø˜H i°Ð;Ð;r   c                 ó(  — |                       ¦   «         D ]l}|                     ¦   «         }|�Tt          |d¦  «        r&|                     ¦   «                              ¦   «         }|                     ¦   «         ||fk    r|c S Œmt          ||| ¬¦  «        S )zo
        Check if the figure already has a gridspec with these dimensions,
        or create a new one
        NÚget_topmost_subplotspec©r4   )Úget_axesÚget_gridspecÚhasattrro   r1   ÚGridSpec)r4   r   r   ÚaxÚgss        r   Ú_check_gridspec_existsz#GridSpecBase._check_gridspec_existsÀ   sœ   € ð —/’/Ñ#Ô#ð 	ð 	ˆBØ—’Ñ"Ô"ˆBØˆ~Ý˜2Ð8Ñ9Ô9ð Eð ×3Ò3Ñ5Ô5×BÒBÑDÔD�BØ—?’?Ñ$Ô$¨°¨Ò6Ð6Ø�I�I�Iøå˜˜u¨VÐ4Ñ4Ô4Ð4r   c                 ó`  — |                       ¦   «         \  }}d„ }t          |t          ¦  «        r\	 |\  }}n"# t          $ r}t          d¦  «        |‚d}~ww xY wt	          j         |||d¦  «         |||d¦  «        g||f¦  «        \  }}	n ||||z  d¦  «        \  }}	t          | ||	¦  «        S )z,Create and return a `.SubplotSpec` instance.c                 ó6  — | }t          | t          ¦  «        r5|                      |¦  «        \  }}}||k    r||dz
  fS t          d¦  «        ‚| dk     r| |z   } d| cxk    r|k     rn n| | fS |�t          d|› d|› d|› �¦  «        ‚t          d|› d|› �¦  «        ‚)Nr   z=GridSpec slice would result in no space allocated for subplotr   zindex z is out of bounds for axis z with size z) is out of bounds for GridSpec with size )r   ÚsliceÚindicesÚ
IndexError)ÚkeyÚsizeÚaxisÚorig_keyÚstartÚstopÚ_s          r   Ú
_normalizez,GridSpecBase.__getitem__.<locals>._normalizeÙ   s  € ØˆHÝ˜#�uÑ%Ô%ð CØ!$§¢¨TÑ!2Ô!2‘��t˜QØ˜%’<�<Ø  $¨¡(˜?Ð*Ý ð "9ñ :ô :ð :ð ˜’7�7Ø ™*�CØ˜�?�?’?�?˜d’?�?�?�?�?Ø ˜8�OØÐ%Ý$ð &E¨hð &Eð &EØ-1ð&Eð &EØ>Bð&Eð &Eñ Fô Fð Fõ %ð &B¨hð &Bð &BØ;?ð&Bð &Bñ Cô Cð Cr   zUnrecognized subplot specNr   r   )r1   r   Útupler   rU   Úravel_multi_indexÚSubplotSpec)
r   r}   r   r   r„   Úk1Úk2ÚerrÚnum1Únum2s
             r   Ú__getitem__zGridSpecBase.__getitem__Õ   sô   € à×(Ò(Ñ*Ô*‰ˆˆuð	Cð 	Cð 	Cõ( �c�5Ñ!Ô!ð 		>ðGØ‘��B�BøÝð Gð Gð GÝ Ð!<Ñ=Ô=À3ÐFøøøøðGøøøåÔ-Ø�˜B  qÑ)Ô)¨:¨:°b¸%ÀÑ+CÔ+CÐDØ˜�ñ ô  ‰JˆD�$�$ð $˜ C¨°©¸Ñ=Ô=‰JˆD�$å˜4  tÑ,Ô,Ð,s   ±7 ·
AÁAÁAFT)ÚsharexÚshareyÚsqueezeÚ
subplot_kwc                óD  — | j         }|€t          d¦  «        ‚t          |t          ¦  «        s|rdnd}t          |t          ¦  «        s|rdnd}t	          j        g d¢||¬¦  «         |€i }|                     ¦   «         }t          j        | j	        | j
        ft          ¬¦  «        }t          | j	        ¦  «        D ]g}t          | j
        ¦  «        D ]P}d|d         ||d	f         |d	|f         d
œ}	|	|         |d<   |	|         |d<    |j        | ||f         fi |¤Ž|||f<   ŒQŒh|dv r |j        D ]}
|
                     d¬¦  «         Œ|dv r |j        D ]}
|
                     d¬¦  «         Œ|r3|j        dk    r|                     ¦   «         n|                     ¦   «         S |S )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)r“   ÚrowÚcolr”   FT)rŽ   r�   )Údtype)r   r   r   )r”   r“   r•   r–   rŽ   r�   )r–   r“   T)Úskip_non_rectangular_axes)r•   r“   r   )r4   r   r   Ústrr   Úcheck_in_listÚcopyrU   Úemptyr   r   ÚobjectÚrangeÚadd_subplotrX   Ú_label_outer_xaxisÚ_label_outer_yaxisr~   Úitemr�   )r   rŽ   r�   r�   r‘   r4   Úaxarrr•   r–   Úshared_withru   s              r   ÚsubplotszGridSpecBase.subplotsú   s(  € ð ”ˆàˆ>Ýð <ñ =ô =ð =õ ˜&¥#Ñ&Ô&ð 	1Ø$Ð0�U�U¨&ˆFÝ˜&¥#Ñ&Ô&ð 	1Ø$Ð0�U�U¨&ˆFåÔÐEÐEÐEØ"(°ð	9ñ 	9ô 	9ð 	9àÐØˆJà—_’_Ñ&Ô&ˆ
õ ”˜$œ+ t¤{Ð3½6ÐBÑBÔBˆÝ˜œÑ%Ô%ð 	2ð 	2ˆCÝ˜Tœ[Ñ)Ô)ð 2ð 2�Ø'+°E¸$´KØ&+¨C°¨F¤m¸EÀ!ÀSÀ&¼MðKð K�à'2°6Ô':�
˜8Ñ$Ø'2°6Ô':�
˜8Ñ$Ø"4 &Ô"4Ø˜˜c˜”Nð#2ð #2Ø&0ð#2ð #2��c˜3�h‘�ð2ð �^Ð#Ð#Ø”jð Fð F�Ø×%Ò%ÀÐ%ÑEÔEÐEÐEØ�^Ð#Ð#Ø”jð Fð F�Ø×%Ò%ÀÐ%ÑEÔEÐEÐEàð 	ð $)¤:°¢? ?�5—:’:‘<”<�<¸¿º¹¼ÐGð ˆLr   )NNr*   )r   r   )r%   Ú
__module__Ú__qualname__Ú__doc__r   r(   Úpropertyr   r   r1   r5   r=   r   r@   r   rC   rm   Ústaticmethodrw   r�   r¥   r3   r   r   r
   r
      sT  € € € € € ðð ð
,ð ,ð ,ð ,ð2
ð 
ð 
ð ˆHÐ-Ð-Ø:ð<ñ <ô <€EàˆHÐ-Ð-Ø=ð?ñ ?ô ?€Eð(ð (ð (ðð ð ð ðð ð ð ð .ð .ð .ð&ð &ð &ð0ð 0ð 0ð'ð 'ð 'ð-<ð -<ð -<ð^ ð5ð 5ñ „\ð5ð(#-ð #-ð #-ðJ "'¨u¸dØ ð3ð 3ð 3ð 3ð 3ð 3ð 3r   r
   c                   ód   ‡ — e Zd ZdZ	 	 	 	 d
ˆ fd„	Zg d¢Zeeeeeedœd„Zdd„Zd„ Z		 	 dd	„Z
ˆ xZS )rt   a  
    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                 ó´   •— || _         || _        || _        || _        || _        |	| _        || _        t          ¦   «                              |||
|¬¦  «         dS )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.

        ©r   r   N)	rN   rP   rO   rQ   rR   rS   r4   Úsuperr   )r   r   r   r4   rN   rP   rO   rQ   rR   rS   r   r   r$   s               €r   r   zGridSpec.__init__:  sl   ø€ ðT ˆŒ	ØˆŒØˆŒ
ØˆŒØˆŒØˆŒØˆŒå‰Œ×Ò˜ Ø&2Ø'4ð 	ñ 	6ô 	6ð 	6ð 	6ð 	6r   ©rN   rP   rO   rQ   rR   rS   c                ó~  — |t           ur|| _        |t           ur|| _        |t           ur|| _        |t           ur|| _        |t           ur|| _        |t           ur|| _        t          j        j	         
                    ¦   «         D ]¸}|j        j        j        D ]¤}|                     ¦   «         �Ž|                     ¦   «                              ¦   «         }	|	                     ¦   «         | k    rP|                     d¬¦  «        }
|                     |                     ¦   «                              |
¦  «        ¦  «         Œ¥Œ¹dS )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 or None, optional
            Spacing between the subplots as a fraction of the average subplot
            width / height.
        NF)Úroot)Ú_UNSETrN   rP   rO   rQ   rR   rS   r   ÚGcfÚfigsÚvaluesÚcanvasr4   ÚaxesÚget_subplotspecro   rr   Ú
get_figureÚ_set_positionÚget_position)r   rN   rP   rO   rQ   rR   rS   Ú
figmanagerru   Ússr[   s              r   ÚupdatezGridSpec.updater  sE  € ð  •vÐÐØˆDŒIØ�ÐÐØ ˆDŒKØ�ÐÐØˆDŒJØ•fÐÐØˆDŒHØ�ÐÐØ ˆDŒKØ�ÐÐØ ˆDŒKå(Ô,Ô1×8Ò8Ñ:Ô:ð 	Qð 	QˆJØ Ô'Ô.Ô3ð Qð Q�Ø×%Ò%Ñ'Ô'Ð3Ø×+Ò+Ñ-Ô-×EÒEÑGÔG�BØ—’Ñ(Ô(¨DÒ0Ð0Ø Ÿmšm°˜mÑ7Ô7˜Ø×(Ò(¨×);Ò);Ñ)=Ô)=×)JÒ)JÈ3Ñ)OÔ)OÑPÔPÐPøðQð	Qð 	Qr   c                 ó¶   ‡ — |€d„ ‰ j         D ¦   «         }t          di |¤Ž}nt          j        |j        ¦  «        } |j        di ˆ fd„‰ j         D ¦   «         ¤Ž |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.
        Nc                 ó:   — i | ]}|t           j        d |z            “ŒS )úfigure.subplot.)ÚmplÚrcParams)rG   Úks     r   ú
<dictcomp>z/GridSpec.get_subplot_params.<locals>.<dictcomp>¤  s7   € ð .ð .ð .Øð •S”\Ð"3°AÑ"5Ô6ð .ð .ð .r   c                 ó2   •— i | ]}|t          ‰|¦  «        “ŒS r3   ©Úgetattr©rG   rÄ   r   s     €r   rÅ   z/GridSpec.get_subplot_params.<locals>.<dictcomp>ª  s%   ø€ ÐMÐMÐM°a˜a¥¨¨qÑ!1Ô!1ÐMÐMÐMr   r3   )Ú_AllowedKeysÚSubplotParamsr›   Úsubplotparsr¾   )r   r4   ÚkwrÌ   s   `   r   r5   zGridSpec.get_subplot_params—  s‰   ø€ ð ˆ>ð.ð .ØÔ,ð.ñ .ô .ˆBå'Ð-Ð-¨"Ð-Ð-ˆKˆKåœ) FÔ$6Ñ7Ô7ˆKàˆÔÐNÐNÐMÐMÐMÐM¸4Ô;LÐMÑMÔMÐNÐNÐNàÐr   c                 ó*   ‡ — ˆ fd„‰ j         D ¦   «         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`.
        c                 ó4   •— g | ]}t          ‰|¦  «        ¯|‘ŒS r3   rÇ   rÉ   s     €r   rJ   z<GridSpec.locally_modified_subplot_params.<locals>.<listcomp>µ  s(   ø€ ÐAÐAÐA�aµ¸¸aÑ0@Ô0@ÐA�ÐAÐAÐAr   )rÊ   r+   s   `r   Úlocally_modified_subplot_paramsz(GridSpec.locally_modified_subplot_params®  s#   ø€ ð BÐAÐAÐA˜4Ô,ÐAÑAÔAÐAr   çHáz®Gñ?c           
      óÈ   — |€|                      ¦   «         }t          j        ||j        t          j        |j        | ¬¦  «        |||||¬¦  «        }|r | j        di |¤Ž dS dS )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)Ú	grid_spec)ÚpadÚh_padÚw_padÚrectr3   )Ú_get_rendererr   Úget_tight_layout_figurer·   Úget_subplotspec_listr¾   )r   r4   ÚrendererrÔ   rÕ   rÖ   r×   Úkwargss           r   Útight_layoutzGridSpec.tight_layout·  sŽ   € ð, ÐØ×+Ò+Ñ-Ô-ˆHÝÔ6Ø�F”KÝÔ.¨v¬{ÀdÐKÑKÔKØ˜# U°%¸dðDñ Dô Dˆð ð 	"ØˆDŒKÐ!Ð!˜&Ð!Ð!Ð!Ð!Ð!ð	"ð 	"r   )	NNNNNNNNNr*   )NrÑ   NNN)r%   r¦   r§   r¨   r   rÊ   r²   r¾   r5   rÐ   rÝ   Ú__classcell__©r$   s   @r   rt   rt   0  sÓ   ø€ € € € € ðð ð -1Ø9=Ø%)Ø26ð46ð 46ð 46ð 46ð 46ð 46ðl JÐIÐI€Là#¨F¸&ÀfØ Vð#Qð #Qð #Qð #Qð #QðJð ð ð ð.Bð Bð Bð -1Ø<@ð"ð "ð "ð "ð "ð "ð "ð "r   rt   c                   ó6   ‡ — e Zd ZdZ	 	 dˆ fd„	Zdd„Zd„ Zˆ xZS )ÚGridSpecFromSubplotSpeczx
    GridSpec whose subplot layout parameters are inherited from the
    location specified by a given SubplotSpec.
    Nc                 ó  •— || _         || _        t          |t          ¦  «        r|| _        nt          d¦  «        ‚| j                             ¦   «         j        | _        t          ¦   «          	                    ||||¬¦  «         dS )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.r­   N)
Ú_wspaceÚ_hspacer   r‡   Ú_subplot_specÚ	TypeErrorrr   r4   r®   r   )	r   r   r   Úsubplot_specrR   rS   r   r   r$   s	           €r   r   z GridSpecFromSubplotSpec.__init__Ü  sœ   ø€ ð& ˆŒØˆŒÝ�l¥KÑ0Ô0ð 	OØ!-ˆDÔÐåðNñOô Oð Oð Ô(×5Ò5Ñ7Ô7Ô>ˆŒÝ‰Œ×Ò˜ Ø&2Ø'4ð 	ñ 	6ô 	6ð 	6ð 	6ð 	6r   c                 ó0  — | j         �| j         n|�|j        j        nt          j        d         }| j        �| j        n|�|j        j        nt          j        d         }| j                             |¦  «        }|j	        \  }}}}t          ||||||¬¦  «        S )z1Return a dictionary of subplot layout parameters.Nzfigure.subplot.hspacezfigure.subplot.wspace)rN   rO   rP   rQ   rR   rS   )rä   rÌ   rS   rÂ   rÃ   rã   rR   rå   r»   ÚextentsrË   )	r   r4   rS   rR   ÚfigboxrN   rP   rO   rQ   s	            r   r5   z*GridSpecFromSubplotSpec.get_subplot_paramsü  s¯   € à"&¤,Ð":�$”,�,Ø4:Ð4F�vÔ)Ô0Ð0Ý”|Ð$;Ô<ð 	ð #'¤,Ð":�$”,�,Ø4:Ð4F�vÔ)Ô0Ð0Ý”|Ð$;Ô<ð 	ð Ô#×0Ò0°Ñ8Ô8ˆØ#)¤>Ñ ˆˆf�e˜Så $¨eØ$*°Ø$*°6ð;ñ ;ô ;ð 	;r   c                 ó4   — | j                              ¦   «         S )zY
        Return the topmost `.SubplotSpec` instance associated with the subplot.
        )rå   ro   r+   s    r   ro   z/GridSpecFromSubplotSpec.get_topmost_subplotspec  s   € ð Ô!×9Ò9Ñ;Ô;Ð;r   )NNNNr*   )r%   r¦   r§   r¨   r   r5   ro   rÞ   rß   s   @r   rá   rá   ×  ss   ø€ € € € € ðð ð &*Ø26ð6ð 6ð 6ð 6ð 6ð 6ð@;ð ;ð ;ð ;ð <ð <ð <ð <ð <ð <ð <r   rá   c                   óÚ   — e Zd ZdZdd„Zd„ Zed„ ¦   «         Zed„ ¦   «         Z	e	j
        d„ ¦   «         Z	d„ Zd	„ Zed
„ ¦   «         Zed„ ¦   «         Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ Zd„ ZdS )r‡   a]  
    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.
    Nc                 ó0   — || _         || _        || _        d S r*   )Ú	_gridspecr‹   rŒ   )r   Úgridspecr‹   rŒ   s       r   r   zSubplotSpec.__init__'  s   € Ø!ˆŒØˆŒ	ØˆŒ	ˆ	ˆ	r   c           
      ó˜   — |                       ¦   «         › d| j        j        › d| j        j        › d| j        j        › d| j        j        › d�
S )NÚ[ú:z, Ú])rr   r8   r�   r‚   r9   r+   s    r   r(   zSubplotSpec.__repr__,  sm   € Ø×$Ò$Ñ&Ô&ð =ð =Ø”<Ô%ð=ð =Ø(,¬Ô(9ð=ð =à”<Ô%ð=ð =à(,¬Ô(9ð=ð =ð =ð 	>r   c                 óf  — t          |¦  «        dk    r‹|\  }t          |t          ¦  «        r|S t          |t          ¦  «        st	          d|›�¦  «        ‚	 t          t          t          |¦  «        ¦  «        \  }}}n_# t          $ r t	          d|›�¦  «        d‚w xY wt          |¦  «        dk    r|\  }}}n$t          j	        ddt          |¦  «        ¬¦  «        ‚t                               | ||¦  «        }|€t          ||| ¬¦  «        }t          |t          ¦  «        rDt          |¦  «        d	k    r1t          d
„ |D ¦   «         ¦  «        st	          d|› �¦  «        ‚|\  }}n@t          |t          ¦  «        r|dk     s	|||z  k    rt	          d||z  › d|›�¦  «        ‚|x}}||dz
  |…         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.
        r   z>Single argument to subplot must be a three-digit integer, not Né   Úsubplotz1 or 3)ÚtakesÚgivenrp   rM   c              3   ó@   K  — | ]}t          |t          ¦  «        V — Œd S r*   )r   r   )rG   Úns     r   ú	<genexpr>z1SubplotSpec._from_subplot_args.<locals>.<genexpr>P  s,   è è € Ð<Ð<°1•z !¥XÑ.Ô.Ð<Ð<Ð<Ð<Ð<Ð<r   z3Subplot specifier tuple must contain integers, not z(num must be an integer with 1 <= num <= z, not )r   r   r‡   r   r   ÚmapÚintr™   r   Únargs_errorrt   rw   r…   r“   )	r4   ÚargsÚargÚrowsÚcolsÚnumrv   ÚiÚjs	            r   Ú_from_subplot_argszSubplotSpec._from_subplot_args1  s  € õ ˆt‰9Œ9˜Š>ˆ>Ø‰DˆCÝ˜#�{Ñ+Ô+ð -Ø�
Ý ¥XÑ.Ô.ð -Ý ð,Ø$'ð,ð ,ñ-ô -ð -ð7Ý"%¥c­3¨s©8¬8Ñ"4Ô"4‘��d˜C˜CøÝð 7ð 7ð 7Ý ð,Ø$'ð,ð ,ñ-ô -à26ð7ð7øøøõ �‰YŒY˜!Š^ˆ^Ø"‰OˆD�$˜˜åÔ" 9°HÅCÈÁIÄIÐNÑNÔNÐNå×,Ò,¨V°T¸4Ñ@Ô@ˆØˆ:Ý˜$ ¨VÐ4Ñ4Ô4ˆBÝ�c�5Ñ!Ô!ð 	¥c¨#¡h¤h°!¢m mÝÐ<Ð<¸Ð<Ñ<Ô<Ñ<Ô<ð Ý ØOÈ#ÐOÐOñô ð ð ‰DˆAˆqˆqå˜c¥8Ñ,Ô,ð °°a²°¸3ÀÀdÁº?¸?Ý ð#¸tÀD¹yð #ð #Øð#ð #ñô ð ð ˆKˆA�Ø�!�A‘#�a�%ŒyÐs   Á&A> Á>Bc                 ó,   — | j         €| j        n| j         S r*   )Ú_num2r‹   r+   s    r   rŒ   zSubplotSpec.num2a  s   € à œJÐ.ˆtŒyˆy°D´JÐ>r   c                 ó   — || _         d S r*   )r  )r   Úvalues     r   rŒ   zSubplotSpec.num2e  s   € àˆŒ
ˆ
ˆ
r   c                 ó   — | j         S r*   )rî   r+   s    r   rr   zSubplotSpec.get_gridspeci  s
   € ØŒ~Ðr   c                 ót   — |                       ¦   «                              ¦   «         \  }}||| j        | j        fS )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``).
        )rr   r1   r‹   rŒ   )r   r  r  s      r   r1   zSubplotSpec.get_geometryl  s8   € ð ×&Ò&Ñ(Ô(×5Ò5Ñ7Ô7‰
ˆˆdØ�T˜4œ9 d¤iÐ/Ð/r   c                 óz   — |                       ¦   «         j        }t          | j        |z  | j        |z  dz   ¦  «        S )z6The rows spanned by this subplot, as a `range` object.r   )rr   r   rž   r‹   rŒ   )r   r   s     r   r8   zSubplotSpec.rowspanw  s;   € ð ×!Ò!Ñ#Ô#Ô)ˆÝ�T”Y %Ñ'¨¬°eÑ);¸aÑ)?Ñ@Ô@Ð@r   c                 ó¢   — |                       ¦   «         j        }t          | j        |z  | j        |z  g¦  «        \  }}t          ||dz   ¦  «        S )z9The columns spanned by this subplot, as a `range` object.r   )rr   r   Úsortedr‹   rŒ   rž   )r   r   Úc1Úc2s       r   r9   zSubplotSpec.colspan}  sR   € ð ×!Ò!Ñ#Ô#Ô)ˆõ ˜œ UÑ*¨D¬I¸Ñ,=Ð>Ñ?Ô?‰ˆˆBÝ�R˜˜a™Ñ Ô Ð r   c                 ó"   — | j         j        dk    S ©Nr   )r8   r�   r+   s    r   Úis_first_rowzSubplotSpec.is_first_row†  ó   € ØŒ|Ô! QÒ&Ð&r   c                 óP   — | j         j        |                      ¦   «         j        k    S r*   )r8   r‚   rr   r   r+   s    r   Úis_last_rowzSubplotSpec.is_last_row‰  ó!   € ØŒ|Ô  D×$5Ò$5Ñ$7Ô$7Ô$=Ò=Ð=r   c                 ó"   — | j         j        dk    S r  )r9   r�   r+   s    r   Úis_first_colzSubplotSpec.is_first_colŒ  r  r   c                 óP   — | j         j        |                      ¦   «         j        k    S r*   )r9   r‚   rr   r   r+   s    r   Úis_last_colzSubplotSpec.is_last_col�  r  r   c                 óÖ  — |                       ¦   «         }|                     ¦   «         \  }}t          j        | j        | j        g||f¦  «        \  }}|                     |¦  «        \  }}}	}
||                              ¦   «         }||                              ¦   «         }|	|                              ¦   «         }|
|                              ¦   «         }t          j
        ||||¦  «        S )zJ
        Update the subplot position from ``figure.subplotpars``.
        )rr   r1   rU   Úunravel_indexr‹   rŒ   rm   ÚminÚmaxr   Úfrom_extents)r   r4   rï   r   r   r  r  rj   ri   rk   rl   Ú
fig_bottomÚfig_topÚfig_leftÚ	fig_rights                  r   r»   zSubplotSpec.get_position’  sÚ   € ð ×$Ò$Ñ&Ô&ˆØ×,Ò,Ñ.Ô.‰ˆˆuÝÔ% t¤y°$´)Ð&<¸uÀe¸nÑMÔM‰
ˆˆdà×'Ò'¨Ñ/Ô/ñ 	5ˆ�X˜y¨*ð ! Ô&×*Ò*Ñ,Ô,ˆ
Ø˜4”.×$Ò$Ñ&Ô&ˆØ˜T”?×&Ò&Ñ(Ô(ˆØ˜tÔ$×(Ò(Ñ*Ô*ˆ	ÝÔ  ¨:°yÀ'ÑJÔJÐJr   c                 óv   — |                       ¦   «         }t          |d¦  «        r|                     ¦   «         S | S )zX
        Return the topmost `SubplotSpec` instance associated with the subplot.
        ro   )rr   rs   ro   )r   rï   s     r   ro   z#SubplotSpec.get_topmost_subplotspec¢  s?   € ð ×$Ò$Ñ&Ô&ˆÝ�8Ð6Ñ7Ô7ð 	Ø×3Ò3Ñ5Ô5Ð5àˆKr   c           	      óÚ   — | j         | j        | j        ft          |dt	          ¦   «         ¦  «        t          |dt	          ¦   «         ¦  «        t          |dt	          ¦   «         ¦  «        fk    S )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È   r�   )r   Úothers     r   Ú__eq__zSubplotSpec.__eq__¬  s\   € ð ” ¤¨D¬IÐ6Ý˜E ;µ±´Ñ9Ô9Ý˜E 6­6©8¬8Ñ4Ô4Ý˜E 6­6©8¬8Ñ4Ô4ð6ò6ð 	7r   c                 óD   — t          | j        | j        | j        f¦  «        S r*   )Úhashrî   r‹   rŒ   r+   s    r   Ú__hash__zSubplotSpec.__hash__·  s   € Ý�T”^ T¤Y°´	Ð:Ñ;Ô;Ð;r   c                 ó    — t          ||| fi |¤Ž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á   )r   r   r   rÜ   s       r   ÚsubgridspeczSubplotSpec.subgridspecº  s   € õP ' u¨e°TÐDÐD¸VÐDÐDÐDr   r*   )r%   r¦   r§   r¨   r   r(   rª   r  r©   rŒ   Úsetterrr   r1   r8   r9   r  r  r  r  r»   ro   r)  r,  r.  r3   r   r   r‡   r‡     s{  € € € € € ðð ð&ð ð ð ð
>ð >ð >ð
 ð*ð *ñ „\ð*ð^ ð?ð ?ñ „Xð?ð 
„[ðð ñ „[ððð ð ð	0ð 	0ð 	0ð ðAð Añ „XðAð
 ð!ð !ñ „Xð!ð'ð 'ð 'ð>ð >ð >ð'ð 'ð 'ð>ð >ð >ðKð Kð Kð ð ð ð	7ð 	7ð 	7ð<ð <ð <ð(Eð (Eð (Eð (Eð (Er   r‡   c                   ó6   — e Zd ZdZ	 	 dd„Z	 	 dd„Zd„ Zd„ ZdS )rË   zM
    Parameters defining the positioning of a subplots grid in a figure.
    Nc                 óŒ   — dD ]&}t          | |t          j        d|› �         ¦  «         Œ'|                      ||||||¦  «         dS )a±  
        Defaults are given by :rc:`figure.subplot.[name]`.

        Parameters
        ----------
        left : float, optional
            The position of the left edge of the subplots,
            as a fraction of the figure width.
        right : float, optional
            The position of the right edge of the subplots,
            as a fraction of the figure width.
        bottom : float, optional
            The position of the bottom edge of the subplots,
            as a fraction of the figure height.
        top : float, optional
            The position of the top edge of the subplots,
            as a fraction of the figure height.
        wspace : float, optional
            The width of the padding between subplots,
            as a fraction of the average Axes width.
        hspace : float, optional
            The height of the padding between subplots,
            as a fraction of the average Axes height.
        r¯   rÁ   N)ÚsetattrrÂ   rÃ   r¾   )r   rN   rP   rO   rQ   rR   rS   r}   s           r   r   zSubplotParams.__init__ê  s]   € ð4 Jð 	Fð 	FˆCÝ�D˜#�sœ|Ð,C¸cÐ,CÐ,CÔDÑEÔEÐEÐEØ�Š�D˜& %¨¨f°fÑ=Ô=Ð=Ð=Ð=r   c                 ó  — |�|n| j         |�|n| j        k    rt          d¦  «        ‚|�|n| j        |�|n| j        k    rt          d¦  «        ‚|�|| _         |�|| _        |�|| _        |�|| _        |�|| _        |�	|| _        dS dS )zY
        Update the dimensions of the passed parameters. *None* means unchanged.
        Nzleft cannot be >= rightzbottom cannot be >= top)rN   rO   r   rP   rQ   rR   rS   )r   rN   rP   rO   rQ   rR   rS   s          r   r¾   zSubplotParams.update  sÈ   € ð
 Ð%ˆTˆT¨4¬9Ø"Ð.�E�E°D´Jò@ð @åÐ6Ñ7Ô7Ð7ØÐ)ˆVˆV¨t¬{Ø˜?�C�C°´ò:ð :åÐ6Ñ7Ô7Ð7ØÐØˆDŒIØÐØˆDŒJØÐØ ˆDŒKØˆ?ØˆDŒHØÐØ ˆDŒKØÐØ ˆDŒKˆKˆKð Ðr   c                 ó|   — |                       ¦   «         D ]&}t          | |t          j        d|› �         ¦  «         Œ'dS )zIRestore the subplot positioning parameters to the default rcParams valuesrÁ   N)Úto_dictr2  rÂ   rÃ   )r   r}   s     r   ÚresetzSubplotParams.reset   sL   € à—<’<‘>”>ð 	Fð 	FˆCÝ�D˜#�sœ|Ð,C¸cÐ,CÐ,CÔDÑEÔEÐEÐEð	Fð 	Fr   c                 ó4   — | j                              ¦   «         S )z2Return a copy of the subplot parameters as a dict.)Ú__dict__r›   r+   s    r   r5  zSubplotParams.to_dict%  s   € àŒ}×!Ò!Ñ#Ô#Ð#r   )NNNNNN)r%   r¦   r§   r¨   r   r¾   r6  r5  r3   r   r   rË   rË   å  sz   € € € € € ðð ð @DØ%)ð>ð >ð >ð >ð< >BØ#'ð!ð !ð !ð !ð0Fð Fð Fð
$ð $ð $ð $ð $r   rË   )r¨   r›   ÚloggingÚnumbersr   ÚnumpyrU   Ú
matplotlibrÂ   r   r   r   Úmatplotlib._apir   r²   Úmatplotlib.transformsr   Ú	getLoggerr%   Ú_logr
   rt   rá   r‡   rË   r3   r   r   ú<module>rA     s¥  ðð
ð 
ð €€€Ø €€€Ø Ð Ð Ð Ð Ð à Ð Ð Ð à Ð Ð Ð Ø :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ð :Ø +Ð +Ð +Ð +Ð +Ð +Ø &Ð &Ð &Ð &Ð &Ð &à€wÔ˜Ñ"Ô"€ðRð Rð Rð Rð Rñ Rô Rð Rðjd"ð d"ð d"ð d"ð d"ˆ|ñ d"ô d"ð d"ðN9<ð 9<ð 9<ð 9<ð 9<˜lñ 9<ô 9<ð 9<ðxOEð OEð OEð OEð OEñ OEô OEð OEðdB$ð B$ð B$ð B$ð B$ñ B$ô B$ð B$ð B$ð B$r   