Skip to content

Commit d041554

Browse files
committed
Display examples for plot_implicit
1 parent 8dce5aa commit d041554

File tree

1 file changed

+68
-23
lines changed

1 file changed

+68
-23
lines changed

sympy/plotting/plot_implicit.py

Lines changed: 68 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -257,48 +257,93 @@ def plot_implicit(expr, x_var=None, y_var=None, adaptive=True, depth=0,
257257
258258
Plot expressions:
259259
260-
>>> from sympy import plot_implicit, cos, sin, symbols, Eq, And
261-
>>> x, y = symbols('x y')
260+
.. plot::
261+
:context: reset
262+
:format: doctest
263+
:include-source: True
262264
263-
Without any ranges for the symbols in the expression
265+
>>> from sympy import plot_implicit, cos, sin, symbols, Eq, And
266+
>>> x, y = symbols('x y')
264267
265-
>>> p1 = plot_implicit(Eq(x**2 + y**2, 5))
268+
Without any ranges for the symbols in the expression:
266269
267-
With the range for the symbols
270+
.. plot::
271+
:context: close-figs
272+
:format: doctest
273+
:include-source: True
268274
269-
>>> p2 = plot_implicit(Eq(x**2 + y**2, 3),
270-
... (x, -3, 3), (y, -3, 3))
275+
>>> plot_implicit(Eq(x**2 + y**2, 5))
271276
272-
With depth of recursion as argument.
277+
With the range for the symbols:
273278
274-
>>> p3 = plot_implicit(Eq(x**2 + y**2, 5),
275-
... (x, -4, 4), (y, -4, 4), depth = 2)
279+
.. plot::
280+
:context: close-figs
281+
:format: doctest
282+
:include-source: True
276283
277-
Using mesh grid and not using adaptive meshing.
284+
>>> plot_implicit(Eq(x**2 + y**2, 3), (x, -3, 3), (y, -3, 3))
278285
279-
>>> p4 = plot_implicit(Eq(x**2 + y**2, 5),
280-
... (x, -5, 5), (y, -2, 2), adaptive=False)
286+
With depth of recursion as argument:
281287
282-
Using mesh grid with number of points as input.
288+
.. plot::
289+
:context: close-figs
290+
:format: doctest
291+
:include-source: True
283292
284-
>>> p5 = plot_implicit(Eq(x**2 + y**2, 5),
285-
... (x, -5, 5), (y, -2, 2),
286-
... adaptive=False, points=400)
293+
>>> plot_implicit(
294+
... Eq(x**2 + y**2, 5), (x, -4, 4), (y, -4, 4), depth = 2)
287295
288-
Plotting regions.
296+
Using mesh grid and not using adaptive meshing:
289297
290-
>>> p6 = plot_implicit(y > x**2)
298+
.. plot::
299+
:context: close-figs
300+
:format: doctest
301+
:include-source: True
291302
292-
Plotting Using boolean conjunctions.
303+
>>> p4 = plot_implicit(
304+
... Eq(x**2 + y**2, 5), (x, -5, 5), (y, -2, 2),
305+
... adaptive=False)
293306
294-
>>> p7 = plot_implicit(And(y > x, y > -x))
307+
Using mesh grid without using adaptive meshing with number of points
308+
specified:
309+
310+
.. plot::
311+
:context: close-figs
312+
:format: doctest
313+
:include-source: True
314+
315+
>>> p5 = plot_implicit(
316+
... Eq(x**2 + y**2, 5), (x, -5, 5), (y, -2, 2),
317+
... adaptive=False, points=400)
318+
319+
Plotting regions:
320+
321+
.. plot::
322+
:context: close-figs
323+
:format: doctest
324+
:include-source: True
325+
326+
>>> p6 = plot_implicit(y > x**2)
327+
328+
Plotting Using boolean conjunctions:
329+
330+
.. plot::
331+
:context: close-figs
332+
:format: doctest
333+
:include-source: True
334+
335+
>>> p7 = plot_implicit(And(y > x, y > -x))
295336
296337
When plotting an expression with a single variable (y - 1, for example),
297338
specify the x or the y variable explicitly:
298339
299-
>>> p8 = plot_implicit(y - 1, y_var=y)
300-
>>> p9 = plot_implicit(x - 1, x_var=x)
340+
.. plot::
341+
:context: close-figs
342+
:format: doctest
343+
:include-source: True
301344
345+
>>> p8 = plot_implicit(y - 1, y_var=y)
346+
>>> p9 = plot_implicit(x - 1, x_var=x)
302347
"""
303348
has_equality = False # Represents whether the expression contains an Equality,
304349
#GreaterThan or LessThan

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy