+
    i                     H    ^ RI Ht ^ RIHu Hu Ht RR./t ! R R4      tR# )    )import_moduleNPlotGrid
matplotlibc                   t   a  ] tR t^t o RtRRRR/R ltR t]R 4       t]R	 4       t	R
 t
R tR tR tRtV tR# )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)

showTsizeNc               D   \        RR. RO/R\        3R7      V n        Wn        W n        . V n        RV n        WPn        V F(  pV P
                  P                  VP
                  4       K*  	  W@n	        V'       d'   V P                  '       d   V P                  4        R# R# R# )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   fromlistz1.1.0)import_kwargsmin_module_versioncatchN)pyplotcmcollections)r   RuntimeErrorr   nrowsncolumns_series_figargsappendr   r   )selfr   r   r   r   r   kwargsargs   &&&$$*, w/Users/tonyclaw/.openclaw/workspace/skills/math-calculator/venv/lib/python3.14/site-packages/sympy/plotting/plotgrid.py__init__PlotGrid.__init__\   s    F (%'FG&|o? 
 		CLL, 	DOOOIIK $4    c                L   V P                   P                  P                  V P                  V P                  4      p/ p^ p\        V P                  4       F_  p\        V P                  4       FC  pV\        V P                  4      8  d   V P                  V,          W!WE3,          &   V^,          pKE  	  Ka  	  V P                  '       g   / MRV P                  /pV P                   P                  P                  ! R/ VB V n        VP                  4        F  w  rx\        VP                  4      ^ 8  d(   VP                  ^ ,          P                  '       d   RR/M/ pV P                  P                  ! V3/ VB p	V P                  Vn        Wn        VP%                  4        K  	  R# )r   figsize
projection3dN )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_figurePlotGrid._create_figure   s;   __%%..tzz4==Itzz"A4==)s499~%(,		!GqtH%Q * # yyyRy$))&<OO**117B7	}}GD+.qyy>A+=		!"""  &)+ YY**4626F"iiAO#N 'r   c                ^    V P                   '       g   V P                  4        V P                   # N)r   r8   r   s   &r   figPlotGrid.fig   s!    yyy!yyr   c                    V # r;   r#   r<   s   &r   _backendPlotGrid._backend   s    r   c                d    V P                   P                  P                  V P                  4       R # r;   )r   r   closer=   r<   s   &r   rC   PlotGrid.close   s    $$TXX.r   c                    \         P                  '       dA   V P                  P                  4        V P                  P
                  P                  4        R # V P                  4        R # r;   )base_backend_showr=   tight_layoutr   r   r   rC   r<   s   &r   r   PlotGrid.show   s=    HH!!#OO""'')JJLr   c                <    V P                   P                  V4       R # r;   )r=   savefig)r   paths   &&r   savePlotGrid.save   s    r   c                    \        V P                  4       UUu. uF  w  rR V,          \        V4      ,           NK   	  pppRRP                  V4      ,           # u uppi )z	Plot[%d]:zPlotGrid object containing:

)	enumerater   strjoin)r   r2   plot	plot_strss   &   r   __str__PlotGrid.__str__   sX    %.tyy%9;%9'! "AoT22%9 	 ; /91EEE;s   $A)r   r   r   r   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   r8   propertyr=   r@   rC   r   rM   rV   __static_attributes____classdictcell__)__classdict__s   @r   r   r      sh     JV/D /t /b(  
  /F Fr   )r   )sympy.externalr   $sympy.plotting.backends.base_backendplottingbackendsrF   __doctest_requires__r   r#   r   r   <module>rf      s-    ( ; ; L> 
lF lFr   