Coverage for /usr/lib/python3/dist-packages/sympy/plotting/pygletplot/__init__.py: 60%
5 statements
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
« prev ^ index » next coverage.py v7.9.1, created at 2025-06-14 15:55 +0200
1"""Plotting module that can plot 2D and 3D functions
2"""
4from sympy.utilities.decorator import doctest_depends_on
6@doctest_depends_on(modules=('pyglet',))
7def PygletPlot(*args, **kwargs):
8 """
10 Plot Examples
11 =============
13 See examples/advanced/pyglet_plotting.py for many more examples.
15 >>> from sympy.plotting.pygletplot import PygletPlot as Plot
16 >>> from sympy.abc import x, y, z
18 >>> Plot(x*y**3-y*x**3)
19 [0]: -x**3*y + x*y**3, 'mode=cartesian'
21 >>> p = Plot()
22 >>> p[1] = x*y
23 >>> p[1].color = z, (0.4,0.4,0.9), (0.9,0.4,0.4)
25 >>> p = Plot()
26 >>> p[1] = x**2+y**2
27 >>> p[2] = -x**2-y**2
30 Variable Intervals
31 ==================
33 The basic format is [var, min, max, steps], but the
34 syntax is flexible and arguments left out are taken
35 from the defaults for the current coordinate mode:
37 >>> Plot(x**2) # implies [x,-5,5,100]
38 [0]: x**2, 'mode=cartesian'
40 >>> Plot(x**2, [], []) # [x,-1,1,40], [y,-1,1,40]
41 [0]: x**2, 'mode=cartesian'
42 >>> Plot(x**2-y**2, [100], [100]) # [x,-1,1,100], [y,-1,1,100]
43 [0]: x**2 - y**2, 'mode=cartesian'
44 >>> Plot(x**2, [x,-13,13,100])
45 [0]: x**2, 'mode=cartesian'
46 >>> Plot(x**2, [-13,13]) # [x,-13,13,100]
47 [0]: x**2, 'mode=cartesian'
48 >>> Plot(x**2, [x,-13,13]) # [x,-13,13,100]
49 [0]: x**2, 'mode=cartesian'
50 >>> Plot(1*x, [], [x], mode='cylindrical')
51 ... # [unbound_theta,0,2*Pi,40], [x,-1,1,20]
52 [0]: x, 'mode=cartesian'
55 Coordinate Modes
56 ================
58 Plot supports several curvilinear coordinate modes, and
59 they independent for each plotted function. You can specify
60 a coordinate mode explicitly with the 'mode' named argument,
61 but it can be automatically determined for Cartesian or
62 parametric plots, and therefore must only be specified for
63 polar, cylindrical, and spherical modes.
65 Specifically, Plot(function arguments) and Plot[n] =
66 (function arguments) will interpret your arguments as a
67 Cartesian plot if you provide one function and a parametric
68 plot if you provide two or three functions. Similarly, the
69 arguments will be interpreted as a curve if one variable is
70 used, and a surface if two are used.
72 Supported mode names by number of variables:
74 1: parametric, cartesian, polar
75 2: parametric, cartesian, cylindrical = polar, spherical
77 >>> Plot(1, mode='spherical')
80 Calculator-like Interface
81 =========================
83 >>> p = Plot(visible=False)
84 >>> f = x**2
85 >>> p[1] = f
86 >>> p[2] = f.diff(x)
87 >>> p[3] = f.diff(x).diff(x)
88 >>> p
89 [1]: x**2, 'mode=cartesian'
90 [2]: 2*x, 'mode=cartesian'
91 [3]: 2, 'mode=cartesian'
92 >>> p.show()
93 >>> p.clear()
94 >>> p
95 <blank plot>
96 >>> p[1] = x**2+y**2
97 >>> p[1].style = 'solid'
98 >>> p[2] = -x**2-y**2
99 >>> p[2].style = 'wireframe'
100 >>> p[1].color = z, (0.4,0.4,0.9), (0.9,0.4,0.4)
101 >>> p[1].style = 'both'
102 >>> p[2].style = 'both'
103 >>> p.close()
106 Plot Window Keyboard Controls
107 =============================
109 Screen Rotation:
110 X,Y axis Arrow Keys, A,S,D,W, Numpad 4,6,8,2
111 Z axis Q,E, Numpad 7,9
113 Model Rotation:
114 Z axis Z,C, Numpad 1,3
116 Zoom: R,F, PgUp,PgDn, Numpad +,-
118 Reset Camera: X, Numpad 5
120 Camera Presets:
121 XY F1
122 XZ F2
123 YZ F3
124 Perspective F4
126 Sensitivity Modifier: SHIFT
128 Axes Toggle:
129 Visible F5
130 Colors F6
132 Close Window: ESCAPE
134 =============================
135 """
137 from sympy.plotting.pygletplot.plot import PygletPlot
138 return PygletPlot(*args, **kwargs)