Ë
    ¨ehZt  ã                   óà   — 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  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y)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                   ó¦   — 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y)Ú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| _        | _        | j                  |«       | j                  |«       y)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        úQ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/matplotlib/gridspec.pyÚ__init__zGridSpecBase.__init__    s‚   € ô ˜%¤Ô*¨e°qªjÜØAÀ%ÀÐKóMð Mä˜%¤Ô*¨e°qªjÜØDÀUÀIÐNóPð Pà#(¨%Ð ˆŒ�T”[Ø×Ñ˜}Ô-Ø×Ñ˜lÕ+ó    c                 óJ  — t        t        | j                  «      «      dk7  rd| j                  ›�nd}t        t        | j                  «      «      dk7  rd| j                  ›�nd}dj	                  | 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__9   s¥   € äœS ×!8Ñ!8Ó9Ó:¸aÒ?ð )¨×)@Ñ)@Ð(CÑDØEGð 	ô œC × 6Ñ 6Ó7Ó8¸AÒ=ð ' t×'=Ñ'=Ð&@ÑAØCEð 	à7×>Ñ>Ø—N‘N×+Ñ+Ø—+‘+Ø—+‘+Ø  9Ñ,ð	 ?ó ð 	r   c                 ó   — | j                   S ©N)r   ©r   s    r   ú<lambda>zGridSpecBase.<lambda>E   ó
   €  $§+¡+€ r   zThe number of rows in the grid.)Údocc                 ó   — | j                   S r)   )r   r*   s    r   r+   zGridSpecBase.<lambda>G   r,   r   z"The number of columns in the grid.c                 ó2   — | 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_geometryJ   s   € ð �{‰{˜DŸK™KÐ'Ð'r   c                  ó   — y r)   © )r   Úfigures     r   Úget_subplot_paramszGridSpecBase.get_subplot_paramsP   s   € àr   c                 ó2   — |\  }}| |||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.
        r2   )r   ÚlocÚrowspanÚcolspanÚloc1Úloc2Úsubplotspecs          r   Únew_subplotspeczGridSpecBase.new_subplotspecT   s4   € ð ‰
ˆˆdØ˜4  W¡Ð,¨d°4¸±<Ð.?Ð?Ñ@ˆØÐr   c                 óŒ   — |€dg| j                   z  }|| _        yt        |«      | j                   k7  rt        d«      ‚|| _        y)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_ratiosd   sT   € ð ÐØ˜3 §¡Ñ,ˆLð ".ˆÕô �Ó $§+¡+Ò-Üð Gó 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_ratiosr   s   € ð ×%Ñ%Ð%r   c                 óŒ   — |€dg| j                   z  }|| _        yt        |«      | j                   k7  rt        d«      ‚|| _        y)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_ratiosz   sT   € ð Ð Ø˜C $§+¡+Ñ-ˆMð #0ˆÕô �Ó 4§;¡;Ò.Üð Dó 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                 ó¾  — | j                  «       \  }}| j                  |«      }|j                  }|j                  }|j                  }|j
                  }|j                  }	|j                  }
||z
  }||z
  }|||
|dz
  z  z   z  }|
|z  }||z  t        | j                  «      z  }| j                  D �cg c]  }||z  ‘Œ	 }}dg|g|dz
  z  z   }t        j                  t        j                  ||g«      j                  «      }|||	|dz
  z  z   z  }|	|z  }||z  t        | j                  «      z  }| j                  D �cg c]  }||z  ‘Œ	 }}dg|g|dz
  z  z   }t        j                  t        j                  ||g«      j                  «      }||z
  j                  d«      j                   \  }}||z   j                  d«      j                   \  }}||||fS c c}w c c}w )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   r   )éÿÿÿÿé   )r0   r4   ÚleftÚrightÚbottomÚtopÚwspaceÚhspaceÚsumr    ÚnpÚcumsumÚcolumn_stackÚflatr!   ÚreshapeÚT)r   Úfigr   r   Úsubplot_paramsrF   rG   rH   rI   rJ   rK   Ú	tot_widthÚ
tot_heightÚcell_hÚsep_hÚnormÚrÚcell_heightsÚsep_heightsÚcell_hsÚcell_wÚsep_wÚcell_widthsÚ
sep_widthsÚcell_wsÚfig_topsÚfig_bottomsÚ	fig_leftsÚ
fig_rightss                                r   Úget_grid_positionszGridSpecBase.get_grid_positions�   s÷  € ð  ×(Ñ(Ó*‰ˆˆuØ×0Ñ0°Ó5ˆØ×"Ñ"ˆØ×$Ñ$ˆØ×&Ñ&ˆØ× Ñ ˆØ×&Ñ&ˆØ×&Ñ&ˆØ˜D‘Lˆ	Ø˜6‘\ˆ
ð ˜u v¨u°Q©wÑ'7Ñ7Ñ8ˆØ˜‘ˆØ˜‰~¤ D×$;Ñ$;Ó <Ñ<ˆØ*.×*AÑ*AÖB Q˜˜D›ÐBˆÐBØ�c˜e˜W¨¨a©Ñ0Ñ1ˆÜ—)‘)œBŸO™O¨[¸,Ð,GÓH×MÑMÓNˆð ˜e f¨e°A©gÑ&6Ñ6Ñ7ˆØ˜‘ˆØ˜‰~¤ D×$:Ñ$:Ó ;Ñ;ˆØ)-×)?Ñ)?Ö@ A�q˜4“xÐ@ˆÐ@Ø�S˜U˜G u¨Q¡wÑ/Ñ0ˆ
Ü—)‘)œBŸO™O¨Z¸Ð,EÓF×KÑKÓLˆà!$ w¡× 7Ñ 7¸Ó @× BÑ BÑˆ�+Ø!%¨¡× 8Ñ 8¸Ó A× CÑ CÑˆ	�:Ø˜H i°Ð;Ð;ùò Cùò As   Â3GÄ>Gc                 óô   — | j                  «       D ]X  }|j                  «       }|€Œt        |d«      r|j                  «       j                  «       }|j	                  «       ||fk(  sŒV|c S  t        ||| ¬«      S )zo
        Check if the figure already has a gridspec with these dimensions,
        or create a new one
        Úget_topmost_subplotspec©r3   )Úget_axesÚget_gridspecÚhasattrri   r0   ÚGridSpec)r3   r   r   ÚaxÚgss        r   Ú_check_gridspec_existsz#GridSpecBase._check_gridspec_exists¿   sx   € ð —/‘/Ó#ò 	ˆBØ—‘Ó"ˆBØ‰~Ü˜2Ð8Ô9ð ×3Ñ3Ó5×BÑBÓD�BØ—?‘?Ó$¨°¨Ó6Ø’Ið	ô ˜˜u¨VÔ4Ð4r   c                 ó*  — | j                  «       \  }}d„ }t        |t        «      r4	 |\  }}t	        j
                   |||d«       |||d«      g||f«      \  }}	n ||||z  d«      \  }}	t        | ||	«      S # t        $ r}t        d«      |‚d}~ww xY w)z,Create and return a `.SubplotSpec` instance.c                 ó   — | }t        | t        «      r,| j                  |«      \  }}}||kD  r||dz
  fS t        d«      ‚| dk  r| |z   } d| cxk  r|k  r| | 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Ô%Ø!$§¡¨TÓ!2‘��t˜QØ˜%’<Ø  $¨¡(˜?Ð*Ü ð "9ó :ð :ð ˜’7Ø ™*�CØ˜”?˜d’?Ø ˜8�Oð #àÐ%Ü$ v¨h¨Zð 8-Ø-1¨F°+¸d¸Vð&Eó Fð Fô % v¨h¨Zð 8;Ø;?¸&ð&Bó Cð Cr   zUnrecognized subplot specNr   r   )r0   r   Útupler   rM   Úravel_multi_indexÚSubplotSpec)
r   rw   r   r   r~   Úk1Úk2ÚerrÚnum1Únum2s
             r   Ú__getitem__zGridSpecBase.__getitem__Ô   sµ   € à×(Ñ(Ó*‰ˆˆuò	Cô( �cœ5Ô!ðGØ‘��Bô ×-Ñ-Ù˜B  qÓ)©:°b¸%ÀÓ+CÐDØ˜�ó ‰JˆD‘$ñ $ C¨°©¸Ó=‰JˆD�$ä˜4  tÓ,Ð,øô ò GÜ Ð!<Ó=À3ÐFûðGús   ¨A8 Á8	BÂBÂBFT)ÚsharexÚshareyÚsqueezeÚ
subplot_kwc                ó6  — | j                   }|€t        d«      ‚t        |t        «      s|rdnd}t        |t        «      s|rdnd}t	        j
                  g d¢||¬«       |€i }|j                  «       }t        j                  | j                  | j                  ft        ¬«      }t        | j                  «      D ]]  }t        | j                  «      D ]C  }d|d   ||d	f   |d	|f   d
œ}	|	|   |d<   |	|   |d<    |j                  | ||f   fi |¤Ž|||f<   ŒE Œ_ |dv r#|j                  D ]  }
|
j                  d¬«       Œ |dv r#|j                  D ]  }
|
j!                  d¬«       Œ |r/|j"                  dk(  r|j%                  «       S |j'                  «       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   )r3   r   r   Ústrr   Úcheck_in_listÚcopyrM   Úemptyr   r   ÚobjectÚrangeÚadd_subplotrP   Ú_label_outer_xaxisÚ_label_outer_yaxisrx   ÚitemrŠ   )r   rˆ   r‰   rŠ   r‹   r3   Úaxarrr�   r�   Úshared_withro   s              r   ÚsubplotszGridSpecBase.subplotsù   sÆ  € ð —‘ˆàˆ>Üð <ó =ð =ô ˜&¤#Ô&Ù$‘U¨&ˆFÜ˜&¤#Ô&Ù$‘U¨&ˆFä×ÑÒEØ"(°õ	9àÐØˆJà—_‘_Ó&ˆ
ô —‘˜$Ÿ+™+ t§{¡{Ð3¼6ÔBˆÜ˜Ÿ™Ó%ò 	2ˆCÜ˜TŸ[™[Ó)ò 2�Ø'+°E¸$±KØ&+¨C°¨F¡m¸EÀ!ÀSÀ&¹MñK�à'2°6Ñ':�
˜8Ñ$Ø'2°6Ñ':�
˜8Ñ$Ø"4 &×"4Ñ"4Ø˜˜c˜‘Nñ#2Ø&0ñ#2��c˜3�h’ñ2ð	2ð �^Ñ#Ø—j‘jò F�Ø×%Ñ%ÀÐ%ÕEðFà�^Ñ#Ø—j‘jò F�Ø×%Ñ%ÀÐ%ÕEðFñ ð $)§:¡:°¢?�5—:‘:“<ÐG¸¿¹»ÐGð ˆLr   )NNr)   )r   r   )r$   Ú
__module__Ú__qualname__Ú__doc__r   r'   Úpropertyr   r   r0   r4   r<   r   r?   r   rB   rg   Ústaticmethodrq   r‡   rŸ   r2   r   r   r	   r	      s‡   „ ñó
,ò2
ñ Ñ-Ø:ô<€EáÑ-Ø=ô?€Eò(óóò .ò&ò0ò'ò-<ð^ ñ5ó ð5ò(#-ðJ "'¨u¸dØ õ3r   r	   c                   óT   ‡ — e Zd ZdZ	 	 	 	 dˆ fd„	Zg d¢Zd„ Zd	d„Zd„ Z	 	 d
d„Z	ˆ xZ
S )rn   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`.
    c                 óŽ   •— || _         || _        || _        || _        || _        |	| _        || _        t        ‰| �!  |||
|¬«       y)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)	rF   rH   rG   rI   rJ   rK   r3   Úsuperr   )r   r   r   r3   rF   rH   rG   rI   rJ   rK   r   r   r#   s               €r   r   zGridSpec.__init__9  sS   ø€ ðT ˆŒ	ØˆŒØˆŒ
ØˆŒØˆŒØˆŒØˆŒä‰Ñ˜ Ø&2Ø'4ð 	õ 	6r   ©rF   rH   rG   rI   rJ   rK   c                 ó0  — |j                  «       D ].  \  }}|| j                  v rt        | ||«       Œ"t        |› d�«      ‚ t        j
                  j                  j                  «       D ]ª  }|j                  j                  j                  D ]…  }|j                  «       €Œ|j                  «       j                  «       }|j                  «       | k(  sŒF|j                  d¬«      }|j                  |j                  «       j!                  |«      «       Œ‡ Œ¬ y)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 keywordNF)Úroot)ÚitemsÚ_AllowedKeysÚsetattrÚAttributeErrorr   ÚGcfÚfigsÚvaluesÚcanvasr3   ÚaxesÚget_subplotspecri   rl   Ú
get_figureÚ_set_positionÚget_position)r   ÚkwargsÚkÚvÚ
figmanagerro   ÚssrS   s           r   ÚupdatezGridSpec.updateq  sþ   € ð —L‘L“Nò 	C‰DˆAˆqØ�D×%Ñ%Ñ%Ü˜˜a Õ#ä$¨ sÐ*@Ð%AÓBÐBð		Cô
 )×,Ñ,×1Ñ1×8Ñ8Ó:ò 	QˆJØ ×'Ñ'×.Ñ.×3Ñ3ò Q�Ø×%Ñ%Ó'Ñ3Ø×+Ñ+Ó-×EÑEÓG�BØ—‘Ó(¨DÓ0Ø Ÿm™m°˜mÓ7˜Ø×(Ñ(¨×);Ñ);Ó)=×)JÑ)JÈ3Ó)OÕPñQñ	Qr   c                 ó:  — |€:| j                   D �ci c]  }|t        j                  d|z      “Œ }}t        di |¤Ž}nt	        j                  |j
                  «      } |j                  di | j                   D �ci c]  }|t        | |«      “Œ c}¤Ž |S c c}w c c}w )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.
        úfigure.subplot.r2   )r­   ÚmplÚrcParamsÚSubplotParamsr•   Úsubplotparsr¾   Úgetattr)r   r3   rº   ÚkwrÄ   s        r   r4   zGridSpec.get_subplot_params�  s¢   € ð ˆ>à×,Ñ,ö.Øð ”S—\‘\Ð"3°AÑ"5Ñ6Ñ6ð .ˆBð .ä'Ñ-¨"Ñ-‰KäŸ)™) F×$6Ñ$6Ó7ˆKàˆ×ÑÑN¸4×;LÑ;LÖM°a˜a¤¨¨qÓ!1Ñ1ÒMÒNàÐùò.ùò Ns   ‘BÁ8Bc                 óZ   — | j                   D �cg c]  }t        | |«      sŒ|‘Œ c}S c c}w )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`.
        )r­   rÅ   )r   rº   s     r   Úlocally_modified_subplot_paramsz(GridSpec.locally_modified_subplot_params¤  s'   € ð  ×,Ñ,ÖA�a´¸¸aÕ0@’ÒAÐAùÒAs   �(¡(c           
      óÞ   — |€|j                  «       }t        j                  ||j                  t        j                  |j                  | ¬«      |||||¬«      }|r | j
                  di |¤Ž yy)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Úrectr2   )Ú_get_rendererr   Úget_tight_layout_figurer´   Úget_subplotspec_listr¾   )r   r3   ÚrendererrË   rÌ   rÍ   rÎ   r¹   s           r   Útight_layoutzGridSpec.tight_layout­  sl   € ð, ÐØ×+Ñ+Ó-ˆHÜ×6Ñ6Ø�F—K‘KÜ×.Ñ.¨v¯{©{ÀdÔKØ˜# U°%¸dôDˆñ ØˆD�K‰KÑ!˜&Ó!ð r   )	NNNNNNNNNr)   )NgHáz®Gñ?NNN)r$   r    r¡   r¢   r   r­   r¾   r4   rÈ   rÓ   Ú__classcell__©r#   s   @r   rn   rn   /  sB   ø„ ñð -1Ø9=Ø%)Ø26õ46òl J€LòQó8ò.Bð -1Ø<@÷"r   rn   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.
    c                 óà   •— || _         || _        t        |t        «      r|| _        nt        d«      ‚| j                  j                  «       j                  | _        t        ‰| �%  ||||¬«       y)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Ú	TypeErrorrl   r3   r¨   r   )	r   r   r   Úsubplot_specrJ   rK   r   r   r#   s	           €r   r   z GridSpecFromSubplotSpec.__init__Ò  st   ø€ ð& ˆŒØˆŒÜ�l¤KÔ0Ø!-ˆDÕäðNóOð Oð ×(Ñ(×5Ñ5Ó7×>Ñ>ˆŒÜ‰Ñ˜ Ø&2Ø'4ð 	õ 	6r   c                 óˆ  — | j                   �| j                   n*|�|j                  j                  nt        j                  d   }| j
                  �| j
                  n*|�|j                  j                  nt        j                  d   }| j                  j                  |«      }|j                  \  }}}}t        ||||||¬«      S )z1Return a dictionary of subplot layout parameters.zfigure.subplot.hspacezfigure.subplot.wspace)rF   rG   rH   rI   rJ   rK   )rÚ   rÄ   rK   rÁ   rÂ   rÙ   rJ   rÛ   r¸   ÚextentsrÃ   )	r   r3   rK   rJ   ÚfigboxrF   rH   rG   rI   s	            r   r4   z*GridSpecFromSubplotSpec.get_subplot_paramsò  sµ   € à"&§,¡,Ð":�$—,’,Ø4:Ð4F�v×)Ñ)×0Ò0Ü—|‘|Ð$;Ñ<ð 	ð #'§,¡,Ð":�$—,’,Ø4:Ð4F�v×)Ñ)×0Ò0Ü—|‘|Ð$;Ñ<ð 	ð ×#Ñ#×0Ñ0°Ó8ˆØ#)§>¡>Ñ ˆˆf�e˜Sä $¨eØ$*°Ø$*°6ô;ð 	;r   c                 ó6   — | j                   j                  «       S )zY
        Return the topmost `.SubplotSpec` instance associated with the subplot.
        )rÛ   ri   r*   s    r   ri   z/GridSpecFromSubplotSpec.get_topmost_subplotspec  s   € ð ×!Ñ!×9Ñ9Ó;Ð;r   )NNNNr)   )r$   r    r¡   r¢   r   r4   ri   rÔ   rÕ   s   @r   r×   r×   Í  s    ø„ ñð &*Ø26õ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y)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                 ó.   — || _         || _        || _        y r)   )Ú	_gridspecr…   r†   )r   Úgridspecr…   r†   s       r   r   zSubplotSpec.__init__  s   € Ø!ˆŒØˆŒ	Øˆ�	r   c           
      óà   — | j                  «       › d| j                  j                  › d| j                  j                  › d| j                  j                  › d| j                  j                  › d�
S )Nú[ú:z, ú])rl   r7   r{   r|   r8   r*   s    r   r'   zSubplotSpec.__repr__"  sc   € Ø×$Ñ$Ó&Ð' qØ—<‘<×%Ñ%Ð& a¨¯©×(9Ñ(9Ð':¸"Ø—<‘<×%Ñ%Ð& a¨¯©×(9Ñ(9Ð':¸!ð=ð 	>r   c                 ó¸  — t        |«      dk(  rS|\  }t        |t        «      r|S t        |t        «      st	        d|›�«      ‚	 t        t        t        |«      «      \  }}}n6t        |«      dk(  r|\  }}}n!t        j                  ddt        |«      ¬«      ‚t        j                  | ||«      }|€t        ||| ¬«      }t        |t        «      r4t        |«      d	k(  r&t        d
„ |D «       «      st	        d|› �«      ‚|\  }}n5t        |t        «      r|dk  s|||z  kD  rt	        d||z  › d|›�«      ‚|x}}||dz
  | S # t        $ r t	        d|›�«      d‚w xY w)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Úgivenrj   rE   c              3   ó<   K  — | ]  }t        |t        «      –— Œ y ­wr)   )r   r   )Ú.0Úns     r   ú	<genexpr>z1SubplotSpec._from_subplot_args.<locals>.<genexpr>F  s   è ø€ Ò<°1”z !¤X×.Ñ<ùs   ‚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_errorrn   rq   r   r�   )	r3   ÚargsÚargÚrowsÚcolsÚnumrp   ÚiÚjs	            r   Ú_from_subplot_argszSubplotSpec._from_subplot_args'  s�  € ô ˆt‹9˜Š>Ø‰DˆCÜ˜#œ{Ô+Ø�
Ü ¤XÔ.Ü ð$Ø$' 7ð,ó-ð -ð7Ü"%¤c¬3¨s«8Ó"4‘��d™Cô
 �‹Y˜!Š^Ø"‰OˆD�$™ä×"Ñ" 9°HÄCÈÃIÔNÐNä×,Ñ,¨V°T¸4Ó@ˆØˆ:Ü˜$ ¨VÔ4ˆBÜ�cœ5Ô!¤c¨#£h°!¢mÜÑ<¸Ô<Ô<Ü ØIÈ#ÈÐOóð ð ‰DˆA‰qä˜c¤8Ô,°°a²¸3ÀÀdÁº?Ü Ø>¸tÀD¹y¸kð JØ˜'ð#óð ð ˆKˆA�Ø�!�A‘#�aˆyÐøô3 ò 7Ü ð$Ø$' 7ð,ó-à26ð7ð7ús   ÁE  Å Ec                 óJ   — | j                   €| j                  S | j                   S r)   )Ú_num2r…   r*   s    r   r†   zSubplotSpec.num2W  s   € à ŸJ™JÐ.ˆt�y‰yÐ>°D·J±JÐ>r   c                 ó   — || _         y r)   )rÿ   )r   Úvalues     r   r†   zSubplotSpec.num2[  s	   € àˆ�
r   c                 ó   — | j                   S r)   )rä   r*   s    r   rl   zSubplotSpec.get_gridspec_  s   € Ø�~‰~Ðr   c                 óx   — | j                  «       j                  «       \  }}||| 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``).
        )rl   r0   r…   r†   )r   rø   rù   s      r   r0   zSubplotSpec.get_geometryb  s6   € ð ×&Ñ&Ó(×5Ñ5Ó7‰
ˆˆdØ�T˜4Ÿ9™9 d§i¡iÐ/Ð/r   c                 óˆ   — | j                  «       j                  }t        | j                  |z  | j                  |z  dz   «      S )z6The rows spanned by this subplot, as a `range` object.r   )rl   r   r˜   r…   r†   )r   r   s     r   r7   zSubplotSpec.rowspanm  s<   € ð ×!Ñ!Ó#×)Ñ)ˆÜ�T—Y‘Y %Ñ'¨¯©°eÑ);¸aÑ)?Ó@Ð@r   c                 ó¨   — | j                  «       j                  }t        | j                  |z  | j                  |z  g«      \  }}t        ||dz   «      S )z9The columns spanned by this subplot, as a `range` object.r   )rl   r   Úsortedr…   r†   r˜   )r   r   Úc1Úc2s       r   r8   zSubplotSpec.colspans  sP   € ð ×!Ñ!Ó#×)Ñ)ˆô ˜Ÿ™ UÑ*¨D¯I©I¸Ñ,=Ð>Ó?‰ˆˆBÜ�R˜˜a™Ó Ð r   c                 ó4   — | j                   j                  dk(  S ©Nr   )r7   r{   r*   s    r   Úis_first_rowzSubplotSpec.is_first_row|  ó   € Ø�|‰|×!Ñ! QÑ&Ð&r   c                 ód   — | j                   j                  | j                  «       j                  k(  S r)   )r7   r|   rl   r   r*   s    r   Úis_last_rowzSubplotSpec.is_last_row  ó&   € Ø�|‰|× Ñ  D×$5Ñ$5Ó$7×$=Ñ$=Ñ=Ð=r   c                 ó4   — | j                   j                  dk(  S r
  )r8   r{   r*   s    r   Úis_first_colzSubplotSpec.is_first_col‚  r  r   c                 ód   — | j                   j                  | j                  «       j                  k(  S r)   )r8   r|   rl   r   r*   s    r   Úis_last_colzSubplotSpec.is_last_col…  r  r   c                 óž  — | j                  «       }|j                  «       \  }}t        j                  | j                  | j
                  g||f«      \  }}|j                  |«      \  }}}	}
||   j                  «       }||   j                  «       }|	|   j                  «       }|
|   j                  «       }t        j                  ||||«      S )zJ
        Update the subplot position from ``figure.subplotpars``.
        )rl   r0   rM   Úunravel_indexr…   r†   rg   ÚminÚmaxr   Úfrom_extents)r   r3   rå   r   r   rø   rù   rd   rc   re   rf   Ú
fig_bottomÚfig_topÚfig_leftÚ	fig_rights                  r   r¸   zSubplotSpec.get_positionˆ  sÉ   € ð ×$Ñ$Ó&ˆØ×,Ñ,Ó.‰ˆˆuÜ×%Ñ% t§y¡y°$·)±)Ð&<¸uÀe¸nÓM‰
ˆˆdà×'Ñ'¨Ó/ñ 	5ˆ�X˜y¨*ð ! Ñ&×*Ñ*Ó,ˆ
Ø˜4‘.×$Ñ$Ó&ˆØ˜T‘?×&Ñ&Ó(ˆØ˜tÑ$×(Ñ(Ó*ˆ	Ü× Ñ  ¨:°yÀ'ÓJÐJr   c                 ó^   — | j                  «       }t        |d«      r|j                  «       S | S )zX
        Return the topmost `SubplotSpec` instance associated with the subplot.
        ri   )rl   rm   ri   )r   rå   s     r   ri   z#SubplotSpec.get_topmost_subplotspec˜  s1   € ð ×$Ñ$Ó&ˆÜ�8Ð6Ô7Ø×3Ñ3Ó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__¢  sS   € ð —‘ §¡¨D¯I©IÐ6Ü˜E ;´³Ó9Ü˜E 6¬6«8Ó4Ü˜E 6¬6«8Ó4ð6ñ6ð 	7r   c                 óZ   — t        | j                  | j                  | j                  f«      S r)   )Úhashrä   r…   r†   r*   s    r   Ú__hash__zSubplotSpec.__hash__­  s    € Ü�T—^‘^ T§Y¡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¸VÑDÐDr   r)   )r$   r    r¡   r¢   r   r'   r¤   rý   r£   r†   Úsetterrl   r0   r7   r8   r  r  r  r  r¸   ri   r   r#  r%  r2   r   r   r�   r�   	  sµ   „ ñó&ò
>ð
 ñ*ó ð*ð^ ñ?ó ð?ð 
‡[�[ñó ðòò	0ð ñAó ðAð
 ñ!ó ð!ò'ò>ò'ò>òKò ò	7ò<ó(Er   r�   c                   ó(   — e Zd ZdZ	 	 dd„Z	 	 dd„Zy)rÃ   zM
    Parameters defining the positioning of a subplots grid in a figure.
    Nc                 ó€   — dD ]#  }t        | |t        j                  d|› �   «       Œ% | j                  ||||||«       y)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.
        r©   rÀ   N)r®   rÁ   rÂ   r¾   )r   rF   rH   rG   rI   rJ   rK   rw   s           r   r   zSubplotParams.__init__à  sH   € ð4 Jò 	FˆCÜ�D˜#œsŸ|™|¨o¸c¸UÐ,CÑDÕEð	Fà�‰�D˜& %¨¨f°fÕ=r   c                 ó"  — |�|n| j                   |�|n| j                  k\  rt        d«      ‚|�|n| j                  |�|n| j                  k\  rt        d«      ‚|�|| _         |�|| _        |�|| _        |�|| _        |�|| _        |�|| _        yy)zY
        Update the dimensions of the passed parameters. *None* means unchanged.
        Nzleft cannot be >= rightzbottom cannot be >= top)rF   rG   r   rH   rI   rJ   rK   )r   rF   rH   rG   rI   rJ   rK   s          r   r¾   zSubplotParams.updateþ  s°   € ð
 Ð%‰T¨4¯9©9Ø"Ð.‘E°D·J±Jò@äÐ6Ó7Ð7ØÐ)‰V¨t¯{©{Ø˜?‘C°·±ò:äÐ6Ó7Ð7ØÐØˆDŒIØÐØˆDŒJØÐØ ˆDŒKØˆ?ØˆDŒHØÐØ ˆDŒKØÐØ ˆD�Kð r   )NNNNNN)r$   r    r¡   r¢   r   r¾   r2   r   r   rÃ   rÃ   Û  s$   „ ñð @DØ%)ó>ð< >BØ#'ô!r   rÃ   )r¢   r•   ÚloggingÚnumbersr   ÚnumpyrM   Ú
matplotlibrÁ   r   r   r   Úmatplotlib.transformsr   Ú	getLoggerr$   Ú_logr	   rn   r×   r�   rÃ   r2   r   r   ú<module>r1     sx   ðñ
ó Û Ý ã ã ß :Ñ :Ý &à€w×Ñ˜Ó"€÷Rñ Rôj["ˆ|ô ["ô|9<˜lô 9<÷xOEñ OE÷d9!ò 9!r   