Ë
    7^(hã  ã                   óF   — d dl mZ d dlmc mc mZ ddgiZ G d„ d«      Zy)é    )Úimport_moduleN)ÚPlotGridÚ
matplotlibc                   ó\   — e Zd ZdZdddœd„Zd„ Zed„ «       Zed„ «       Zd	„ Z	d
„ Z
d„ Zd„ Zy)r   aÁ	  This class helps to plot subplots from already created SymPy plots
    in a single figure.

    Examples
    ========

    .. plot::
       :context: close-figs
       :format: doctest
       :include-source: True

        >>> from sympy import symbols
        >>> from sympy.plotting import plot, plot3d, PlotGrid
        >>> x, y = symbols('x, y')
        >>> p1 = plot(x, x**2, x**3, (x, -5, 5))
        >>> p2 = plot((x**2, (x, -6, 6)), (x, (x, -5, 5)))
        >>> p3 = plot(x**3, (x, -5, 5))
        >>> p4 = plot3d(x*y, (x, -5, 5), (y, -5, 5))

    Plotting vertically in a single line:

    .. plot::
       :context: close-figs
       :format: doctest
       :include-source: True

        >>> PlotGrid(2, 1, p1, p2)
        PlotGrid object containing:
        Plot[0]:Plot object containing:
        [0]: cartesian line: x for x over (-5.0, 5.0)
        [1]: cartesian line: x**2 for x over (-5.0, 5.0)
        [2]: cartesian line: x**3 for x over (-5.0, 5.0)
        Plot[1]:Plot object containing:
        [0]: cartesian line: x**2 for x over (-6.0, 6.0)
        [1]: cartesian line: x for x over (-5.0, 5.0)

    Plotting horizontally in a single line:

    .. plot::
       :context: close-figs
       :format: doctest
       :include-source: True

        >>> PlotGrid(1, 3, p2, p3, p4)
        PlotGrid object containing:
        Plot[0]:Plot object containing:
        [0]: cartesian line: x**2 for x over (-6.0, 6.0)
        [1]: cartesian line: x for x over (-5.0, 5.0)
        Plot[1]:Plot object containing:
        [0]: cartesian line: x**3 for x over (-5.0, 5.0)
        Plot[2]:Plot object containing:
        [0]: cartesian surface: x*y for x over (-5.0, 5.0) and y over (-5.0, 5.0)

    Plotting in a grid form:

    .. plot::
       :context: close-figs
       :format: doctest
       :include-source: True

        >>> PlotGrid(2, 2, p1, p2, p3, p4)
        PlotGrid object containing:
        Plot[0]:Plot object containing:
        [0]: cartesian line: x for x over (-5.0, 5.0)
        [1]: cartesian line: x**2 for x over (-5.0, 5.0)
        [2]: cartesian line: x**3 for x over (-5.0, 5.0)
        Plot[1]:Plot object containing:
        [0]: cartesian line: x**2 for x over (-6.0, 6.0)
        [1]: cartesian line: x for x over (-5.0, 5.0)
        Plot[2]:Plot object containing:
        [0]: cartesian line: x**3 for x over (-5.0, 5.0)
        Plot[3]:Plot object containing:
        [0]: cartesian surface: x*y for x over (-5.0, 5.0) and y over (-5.0, 5.0)

    TN)ÚshowÚsizec                ó*  — t        ddg d¢idt        f¬«      | _        || _        || _        g | _        d| _        || _        |D ]'  }| j
                  j                  |j
                  «       Œ) || _	        |r| j                  r| j                  «        yyy)aá  
        Parameters
        ==========

        nrows :
            The number of rows that should be in the grid of the
            required subplot.
        ncolumns :
            The number of columns that should be in the grid
            of the required subplot.

        nrows and ncolumns together define the required grid.

        Arguments
        =========

        A list of predefined plot objects entered in a row-wise sequence
        i.e. plot objects which are to be in the top row of the required
        grid are written first, then the second row objects and so on

        Keyword arguments
        =================

        show : Boolean
            The default value is set to ``True``. Set show to ``False`` and
            the function will not display the subplot. The returned instance
            of the ``PlotGrid`` class can then be used to save or display the
            plot by calling the ``save()`` and ``show()`` methods
            respectively.
        size : (float, float), optional
            A tuple in the form (width, height) in inches to specify the size of
            the overall figure. The default value is set to ``None``, meaning
            the size will be set by the default backend.
        r   Úfromlist)ÚpyplotÚcmÚcollectionsz1.1.0)Úimport_kwargsÚmin_module_versionÚcatchN)r   ÚRuntimeErrorr   ÚnrowsÚncolumnsÚ_seriesÚ_figÚargsÚappendr   r   )Úselfr   r   r   r   r   ÚkwargsÚargs           úU/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/sympy/plotting/plotgrid.pyÚ__init__zPlotGrid.__init__\   s�   € ôF (¨Ø%Ò'FÐGØ&¬|¨oô?ˆŒð ˆŒ
Ø ˆŒØˆŒØˆŒ	ØˆŒ	Øò 	-ˆCØ�L‰L×Ñ §¡Õ,ð	-àˆŒ	Ù�D—O’OØ�I‰I�Kð $ˆ4ó    c                 ó  — | j                   j                  j                  | j                  | j                  «      }i }d}t        | j                  «      D ]P  }t        | j                  «      D ]6  }|t        | j                  «      k  r| j                  |   ||||f   <   |dz  }Œ8 ŒR | j                  si nd| j                  i} | j                   j                  j                  di |¤Ž| _        |j                  «       D ]�  \  }}t        |j                  «      dkD  r|j                  d   j                  rddini } | j                  j                  |fi |¤Ž}	| j                  |_        |	|_        |j%                  «        Œƒ y )Nr   é   ÚfigsizeÚ
projectionÚ3d© )r   ÚgridspecÚGridSpecr   r   ÚrangeÚlenr   r   r   Úfigurer   Úitemsr   Úis_3DÚadd_subplotÚ_plotgrid_figÚ_plotgrid_axÚprocess_series)
r   ÚgsÚmappingÚcÚiÚjÚkwÚspecÚpÚcur_axs
             r   Ú_create_figurezPlotGrid._create_figure�   sQ  € Ø�_‰_×%Ñ%×.Ñ.¨t¯z©z¸4¿=¹=ÓIˆØˆØˆÜ�t—z‘zÓ"ò 	ˆAÜ˜4Ÿ=™=Ó)ò �Ø”s˜4Ÿ9™9“~Ò%Ø(,¯	©	°!©�G˜B˜q !˜t™HÑ%Ø�Q‘‘ñð	ð —y’y‰R y°$·)±)Ð&<ˆØ1�D—O‘O×*Ñ*×1Ñ1Ñ7°BÑ7ˆŒ	Ø—}‘}“ò 	‰GˆD�!Ü+.¨q¯y©y«>¸AÒ+=Ø—	‘	˜!‘×"Ò"ð   Ñ&Ø)+ð à*�T—Y‘Y×*Ñ*¨4Ñ6°2Ñ6ˆFØ"Ÿi™iˆAŒOØ#ˆAŒNØ×ÑÕñ	r   c                 óR   — | j                   s| j                  «        | j                   S ©N)r   r8   ©r   s    r   ÚfigzPlotGrid.fig¡   s   € à�yŠyØ×ÑÔ!Ø�y‰yÐr   c                 ó   — | S r:   r#   r;   s    r   Ú_backendzPlotGrid._backend§   s   € àˆr   c                 ób   — | j                   j                  j                  | j                  «       y r:   )r   r   Úcloser<   r;   s    r   r@   zPlotGrid.close«   s   € Ø�‰×Ñ×$Ñ$ T§X¡XÕ.r   c                 óÂ   — t         j                  r?| j                  j                  «        | j                  j
                  j                  «        y | j                  «        y r:   )Úbase_backendÚ_showr<   Útight_layoutr   r   r   r@   r;   s    r   r   zPlotGrid.show®   s:   € Ü×ÒØ�H‰H×!Ñ!Ô#Ø�O‰O×"Ñ"×'Ñ'Õ)à�J‰J�Lr   c                 ó:   — | j                   j                  |«       y r:   )r<   Úsavefig)r   Úpaths     r   ÚsavezPlotGrid.saveµ   s   € Ø�‰×Ñ˜Õr   c                 ó¢   — t        | j                  «      D ��cg c]  \  }}d|z  t        |«      z   ‘Œ }}}ddj                  |«      z   S c c}}w )Nz	Plot[%d]:zPlotGrid object containing:
ú
)Ú	enumerater   ÚstrÚjoin)r   r2   ÚplotÚ	plot_strss       r   Ú__str__zPlotGrid.__str__¸   sT   € ä%.¨t¯y©yÓ%9÷;Ù!˜!˜Tð " A‘o¬¨T«Ó2ð ;ˆ	ñ ;ð /°·±¸9Ó1EÑEÐEùó;s   ™A)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r8   Úpropertyr<   r>   r@   r   rH   rP   r#   r   r   r   r      sX   „ ñJðV 59¸tô /òbð( ñó ðð
 ñó ðò/òòóFr   r   )Úsympy.externalr   Ú$sympy.plotting.backends.base_backendÚplottingÚbackendsrB   Ú__doctest_requires__r   r#   r   r   ú<module>r[      s-   ðå (ß ;Ó ;ð �L�>ðÐ ÷
lFò lFr   