
    \h?:                     `    S SK JrJr  S SKJr  S SKJr  SS/0rSqS r	S r
S	 r " S
 S5      rg)    )
BaseSeriesGenericDataSeriessympy_deprecation_warning)is_sequence)zPlot.appendzPlot.extend
matplotlibTc                      Sq g)z'
Disable show(). For use in the tests.
FN)_show     \/var/www/auris/envauris/lib/python3.13/site-packages/sympy/plotting/backends/base_backend.py
unset_showr      s	    
 Er   c                 *    [        SU  SU  S3SSSS9  g )NzThe `z` property is deprecated. The `z` keyword argument should be passed to a plotting function, which generates the appropriate data series. If needed, index the plot object to retrieve a specific data series.z1.13z.deprecated-markers-annotations-fill-rectangles   )deprecated_since_versionactive_deprecations_target
stacklevelr   )attrs    r   _deprecation_msg_m_a_r_fr      s-    
v4TF ;+ 	+ "(#Sr   c            	          / SQn/ nU Hk  nU R                  U/ 5      nUc  / n[        U[        5      (       a  U/nU H3  nUR                  S/ 5      nUR                  [	        U/UQ70 UD65        M5     Mm     U$ )N)annotationsmarkersfill
rectanglesargs)pop
isinstancedictappendr   )kwargskeywordsserieskwdictionariesdr   s          r   _create_generic_data_seriesr&   "   s    ?HFzz"b)LlD))(>LA55$DMM+B;;;<   Mr   c                   r   \ rS rSrSrSSSSSSSSSSSSSSSSSSS	SS
.S jr\S 5       r\S 5       rS r	S r
S rS rS rS rS rS rS r\S 5       r\R&                  S 5       r\S 5       r\R&                  S 5       r\S 5       r\R&                  S 5       r\S 5       r\R&                  S 5       rSrg) Plot1   a  Base class for all backends. A backend represents the plotting library,
which implements the necessary functionalities in order to use SymPy
plotting functions.

For interactive work the function :func:`plot` is better suited.

This class permits the plotting of SymPy expressions using numerous
backends (:external:mod:`matplotlib`, textplot, the old pyglet module for SymPy, Google
charts api, etc).

The figure can contain an arbitrary number of plots of SymPy expressions,
lists of coordinates of points, etc. Plot has a private attribute _series that
contains all data series to be plotted (expressions for lines or surfaces,
lists of points, etc (all subclasses of BaseSeries)). Those data series are
instances of classes not imported by ``from sympy import *``.

The customization of the figure is on two levels. Global options that
concern the figure as a whole (e.g. title, xlabel, scale, etc) and
per-data series options (e.g. name) and aesthetics (e.g. color, point shape,
line type, etc.).

The difference between options and aesthetics is that an aesthetic can be
a function of the coordinates (or parameters in a parametric plot). The
supported values for an aesthetic are:

- None (the backend uses default values)
- a constant
- a function of one variable (the first coordinate or parameter)
- a function of two variables (the first and second coordinate or parameters)
- a function of three variables (only in nonparametric 3D plots)

Their implementation depends on the backend so they may not work in some
backends.

If the plot is parametric and the arity of the aesthetic function permits
it the aesthetic is calculated over parameters and not over coordinates.
If the arity does not permit calculation over parameters the calculation is
done over coordinates.

Only cartesian coordinates are supported for the moment, but you can use
the parametric plots to plot in polar, spherical and cylindrical
coordinates.

The arguments for the constructor Plot must be subclasses of BaseSeries.

Any global option can be specified as a keyword argument.

The global options for a figure are:

- title : str
- xlabel : str or Symbol
- ylabel : str or Symbol
- zlabel : str or Symbol
- legend : bool
- xscale : {'linear', 'log'}
- yscale : {'linear', 'log'}
- axis : bool
- axis_center : tuple of two floats or {'center', 'auto'}
- xlim : tuple of two floats
- ylim : tuple of two floats
- aspect_ratio : tuple of two floats or {'auto'}
- autoscale : bool
- margin : float in [0, 1]
- backend : {'default', 'matplotlib', 'text'} or a subclass of BaseBackend
- size : optional tuple of two floats, (width, height); default: None

The per data series options and aesthetics are:
There are none in the base series. See below for options for subclasses.

Some data series support additional aesthetics or options:

:class:`~.LineOver1DRangeSeries`, :class:`~.Parametric2DLineSeries`, and
:class:`~.Parametric3DLineSeries` support the following:

Aesthetics:

- line_color : string, or float, or function, optional
    Specifies the color for the plot, which depends on the backend being
    used.

    For example, if ``MatplotlibBackend`` is being used, then
    Matplotlib string colors are acceptable (``"red"``, ``"r"``,
    ``"cyan"``, ``"c"``, ...).
    Alternatively, we can use a float number, 0 < color < 1, wrapped in a
    string (for example, ``line_color="0.5"``) to specify grayscale colors.
    Alternatively, We can specify a function returning a single
    float value: this will be used to apply a color-loop (for example,
    ``line_color=lambda x: math.cos(x)``).

    Note that by setting line_color, it would be applied simultaneously
    to all the series.

Options:

- label : str
- steps : bool
- integers_only : bool

:class:`~.SurfaceOver2DRangeSeries` and :class:`~.ParametricSurfaceSeries`
support the following:

Aesthetics:

- surface_color : function which returns a float.

Notes
=====

How the plotting module works:

1. Whenever a plotting function is called, the provided expressions are
   processed and a list of instances of the
   :class:`~sympy.plotting.series.BaseSeries` class is created, containing
   the necessary information to plot the expressions
   (e.g. the expression, ranges, series name, ...). Eventually, these
   objects will generate the numerical data to be plotted.
2. A subclass of :class:`~.Plot` class is instantiaed (referred to as
   backend, from now on), which stores the list of series and the main
   attributes of the plot (e.g. axis labels, title, ...).
   The backend implements the logic to generate the actual figure with
   some plotting library.
3. When the ``show`` command is executed, series are processed one by one
   to generate numerical data and add it to the figure. The backend is also
   going to set the axis labels, title, ..., according to the values stored
   in the Plot instance.

The backend should check if it supports the data series that it is given
(e.g. :class:`TextBackend` supports only
:class:`~sympy.plotting.series.LineOver1DRangeSeries`).

It is the backend responsibility to know how to use the class of data series
that it's given. Note that the current implementation of the ``*Series``
classes is "matplotlib-centric": the numerical data returned by the
``get_points`` and ``get_meshes`` methods is meant to be used directly by
Matplotlib. Therefore, the new backend will have to pre-process the
numerical data to make it compatible with the chosen plotting library.
Keep in mind that future SymPy versions may improve the ``*Series`` classes
in order to return numerical data "non-matplotlib-centric", hence if you code
a new backend you have the responsibility to check if its working on each
SymPy release.

Please explore the :class:`MatplotlibBackend` source code to understand
how a backend should be coded.

In order to be used by SymPy plotting functions, a backend must implement
the following methods:

* show(self): used to loop over the data series, generate the numerical
    data, plot it and set the axis labels, title, ...
* save(self, path): used to save the current plot to the specified file
    path.
* close(self): used to close the current plot backend (note: some plotting
    library does not support this functionality. In that case, just raise a
    warning).
NautoTlinearFr   default)titlexlabelylabelzlabelaspect_ratioxlimylimaxis_centeraxisxscaleyscalelegend	autoscalemarginr   r   r   r   backendsizec          	        ^ ^^ UT l         UT l        UT l        UT l        UT l        UT l        U	T l        U
T l        UT l        UT l	        UT l
        UT l        UT l        UT l        UT l        UT l        / T l        T R                   R#                  U5        T R                   R#                  [%        UUUUS95        S mS mUUU 4S jnS T l        U" SU5        S T l        U" SU5        S T l        U" SU5        g )N)r   r   r   r   c                 &    [        S U  5       5      $ )Nc              3   <   #    U  H  n[        US S5      v   M     g7f)is_realTNgetattr.0is     r   	<genexpr>2Plot.__init__.<locals>.<lambda>.<locals>.<genexpr>   s     EAGAy$77   alllims    r   <lambda>Plot.__init__.<locals>.<lambda>   s    EEEr   c                 &    [        S U  5       5      $ )Nc              3   <   #    U  H  n[        US S5      v   M     g7f)	is_finiteTNrA   rC   s     r   rF   rG      s     G3aGA{D993rH   rI   rK   s    r   rM   rN      s    G3GGr   c           	         > U(       av  T" U5      (       d  [        SR                  X5      5      eT" U5      (       d  [        SR                  X5      5      e[        TU [        US   5      [        US   5      45        g g )Nz#All numbers from {}={} must be realz%All numbers from {}={} must be finiter      )
ValueErrorformatsetattrfloat)t_nametrQ   r@   selfs     r   check_and_set$Plot.__init__.<locals>.check_and_set   sx    qzz$9@@KM M ||$;BB6MO OfuQqT{E!A$K&@A r   r2   r3   r<   )r-   r.   r/   r0   r1   r4   r5   r6   r7   r8   r9   r:   _annotations_markers_rectangles_fill_seriesextendr&   r2   r3   r<   )rZ   r-   r.   r/   r0   r1   r2   r3   r4   r5   r6   r7   r8   r9   r:   r   r   r   r   r;   r<   r   r    r[   rQ   r@   s   `                       @@r   __init__Plot.__init__   s	    
(&	"'%
 D!7#W 	
 F 	 H 		B 	fd#	fd#	fd#r   c                     U $ Nr   rZ   s    r   _backendPlot._backend  s    r   c                     [        U 5      $ rf   )typerg   s    r   r;   Plot.backend  s    Dzr   c                     [        U R                  5       VVs/ s H  u  pSU-  [        U5      -   PM     nnnSSR                  U5      -   $ s  snnf )Nz[%d]: zPlot object containing:

)	enumeratera   strjoin)rZ   rE   sseries_strss       r   __str__Plot.__str__  sS    #,T\\#:<#:41 !1A.#: 	 <*TYY{-CCC<s   Ac                      U R                   U   $ rf   ra   rZ   indexs     r   __getitem__Plot.__getitem__  s    ||E""r   c                 r    [        U5      S:X  a(  [        US   [        5      (       a  X R                  U'   g g g )NrS   r   )lenr   r   ra   )rZ   ry   r   s      r   __setitem__Plot.__setitem__  s0    t9>ja*=="&LL >>r   c                     U R                   U	 g rf   rw   rx   s     r   __delitem__Plot.__delitem__  s    LLr   c                 z    [        U[        5      (       a  U R                  R                  U5        g[	        S5      e)a  Adds an element from a plot's series to an existing plot.

Examples
========

Consider two ``Plot`` objects, ``p1`` and ``p2``. To add the
second plot's first series object to the first, use the
``append`` method, like so:

.. plot::
   :format: doctest
   :include-source: True

   >>> from sympy import symbols
   >>> from sympy.plotting import plot
   >>> x = symbols('x')
   >>> p1 = plot(x*x, show=False)
   >>> p2 = plot(x, show=False)
   >>> p1.append(p2[0])
   >>> p1
   Plot object containing:
   [0]: cartesian line: x**2 for x over (-10.0, 10.0)
   [1]: cartesian line: x for x over (-10.0, 10.0)
   >>> p1.show()

See Also
========

extend

z'Must specify element of plot to append.N)r   r   ra   r   	TypeErrorrZ   args     r   r   Plot.append  s0    @ c:&&LL$EFFr   c                     [        U[        5      (       a&  U R                  R                  UR                  5        g[	        U5      (       a  U R                  R                  U5        g[        S5      e)a{  Adds all series from another plot.

Examples
========

Consider two ``Plot`` objects, ``p1`` and ``p2``. To add the
second plot to the first, use the ``extend`` method, like so:

.. plot::
   :format: doctest
   :include-source: True

   >>> from sympy import symbols
   >>> from sympy.plotting import plot
   >>> x = symbols('x')
   >>> p1 = plot(x**2, show=False)
   >>> p2 = plot(x, -x, show=False)
   >>> p1.extend(p2)
   >>> p1
   Plot object containing:
   [0]: cartesian line: x**2 for x over (-10.0, 10.0)
   [1]: cartesian line: x for x over (-10.0, 10.0)
   [2]: cartesian line: -x for x over (-10.0, 10.0)
   >>> p1.show()

z(Expecting Plot or sequence of BaseSeriesN)r   r(   ra   rb   r   r   r   s     r   rb   Plot.extendD  sP    6 c4  LL,LL$FGGr   c                     [         erf   NotImplementedErrorrg   s    r   show	Plot.showf      !!r   c                     [         erf   r   )rZ   paths     r   save	Plot.savei  r   r   c                     [         erf   r   rg   s    r   close
Plot.closel  r   r   c                 0    [        S5        U R                  $ ).. deprecated:: 1.13r   )r   r^   rg   s    r   r   Plot.markersq  s     	!+}}r   c                 j    [        S5        U R                  R                  [        US95        Xl        g)r   r   )r   N)r   ra   rb   r&   r^   rZ   vs     r   r   r   w  s)     	!+7BCr   c                 0    [        S5        U R                  $ )r   r   )r   r]   rg   s    r   r   Plot.annotations~  s     	!/   r   c                 j    [        S5        U R                  R                  [        US95        Xl        g)r   r   )r   N)r   ra   rb   r&   r]   r   s     r   r   r     s*     	!/7AFGr   c                 0    [        S5        U R                  $ )r   r   )r   r_   rg   s    r   r   Plot.rectangles  s     	!.r   c                 j    [        S5        U R                  R                  [        US95        Xl        g)r   r   )r   N)r   ra   rb   r&   r_   r   s     r   r   r     s*     	!.71EFr   c                 0    [        S5        U R                  $ )r   r   )r   r`   rg   s    r   r   	Plot.fill  s     	!(zzr   c                 j    [        S5        U R                  R                  [        US95        Xl        g)r   r   )r   N)r   ra   rb   r&   r`   r   s     r   r   r     s)     	!(7Q?@
r   )r]   r`   r^   r_   ra   r1   r9   r5   r4   r8   r:   r<   r-   r.   r2   r6   r/   r3   r7   r0   )__name__
__module____qualname____firstlineno____doc__rc   propertyrh   r;   rt   rz   r~   r   r   rb   r   r   r   r   setterr   r   r   __static_attributes__r   r   r   r(   r(   1   sL   Zz 4T&t$dDT948$t    D
#' #GJ HD"""
  
 ^^  ! !
      
    
 
[[ r   r(   N)sympy.plotting.seriesr   r   sympy.utilities.exceptionsr   sympy.utilities.iterablesr   __doctest_requires__r
   r   r   r&   r(   r   r   r   <module>r      sA    ? @ 1 #\N  	r rr   