passagemath-plot 10.6.31rc3__cp314-cp314-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of passagemath-plot might be problematic. Click here for more details.

Files changed (82) hide show
  1. passagemath_plot-10.6.31rc3.dist-info/METADATA +172 -0
  2. passagemath_plot-10.6.31rc3.dist-info/RECORD +82 -0
  3. passagemath_plot-10.6.31rc3.dist-info/WHEEL +6 -0
  4. passagemath_plot-10.6.31rc3.dist-info/top_level.txt +2 -0
  5. passagemath_plot.libs/libgfortran-83c28eba.so.5.0.0 +0 -0
  6. passagemath_plot.libs/libgsl-cda90e79.so.28.0.0 +0 -0
  7. passagemath_plot.libs/libopenblasp-r0-6dcb67f9.3.29.so +0 -0
  8. passagemath_plot.libs/libquadmath-2284e583.so.0.0.0 +0 -0
  9. sage/all__sagemath_plot.py +15 -0
  10. sage/ext_data/threejs/animation.css +195 -0
  11. sage/ext_data/threejs/animation.html +85 -0
  12. sage/ext_data/threejs/animation.js +273 -0
  13. sage/ext_data/threejs/fat_lines.js +48 -0
  14. sage/ext_data/threejs/threejs-version.txt +1 -0
  15. sage/ext_data/threejs/threejs_template.html +597 -0
  16. sage/interfaces/all__sagemath_plot.py +1 -0
  17. sage/interfaces/gnuplot.py +196 -0
  18. sage/interfaces/jmoldata.py +208 -0
  19. sage/interfaces/povray.py +56 -0
  20. sage/plot/all.py +42 -0
  21. sage/plot/animate.py +1796 -0
  22. sage/plot/arc.py +504 -0
  23. sage/plot/arrow.py +671 -0
  24. sage/plot/bar_chart.py +205 -0
  25. sage/plot/bezier_path.py +400 -0
  26. sage/plot/circle.py +435 -0
  27. sage/plot/colors.py +1606 -0
  28. sage/plot/complex_plot.cpython-314-x86_64-linux-gnu.so +0 -0
  29. sage/plot/complex_plot.pyx +1446 -0
  30. sage/plot/contour_plot.py +1792 -0
  31. sage/plot/density_plot.py +318 -0
  32. sage/plot/disk.py +373 -0
  33. sage/plot/ellipse.py +375 -0
  34. sage/plot/graphics.py +3580 -0
  35. sage/plot/histogram.py +354 -0
  36. sage/plot/hyperbolic_arc.py +404 -0
  37. sage/plot/hyperbolic_polygon.py +416 -0
  38. sage/plot/hyperbolic_regular_polygon.py +296 -0
  39. sage/plot/line.py +626 -0
  40. sage/plot/matrix_plot.py +629 -0
  41. sage/plot/misc.py +509 -0
  42. sage/plot/multigraphics.py +1294 -0
  43. sage/plot/plot.py +4183 -0
  44. sage/plot/plot3d/all.py +23 -0
  45. sage/plot/plot3d/base.cpython-314-x86_64-linux-gnu.so +0 -0
  46. sage/plot/plot3d/base.pxd +12 -0
  47. sage/plot/plot3d/base.pyx +3378 -0
  48. sage/plot/plot3d/implicit_plot3d.py +659 -0
  49. sage/plot/plot3d/implicit_surface.cpython-314-x86_64-linux-gnu.so +0 -0
  50. sage/plot/plot3d/implicit_surface.pyx +1453 -0
  51. sage/plot/plot3d/index_face_set.cpython-314-x86_64-linux-gnu.so +0 -0
  52. sage/plot/plot3d/index_face_set.pxd +32 -0
  53. sage/plot/plot3d/index_face_set.pyx +1873 -0
  54. sage/plot/plot3d/introduction.py +131 -0
  55. sage/plot/plot3d/list_plot3d.py +649 -0
  56. sage/plot/plot3d/parametric_plot3d.py +1130 -0
  57. sage/plot/plot3d/parametric_surface.cpython-314-x86_64-linux-gnu.so +0 -0
  58. sage/plot/plot3d/parametric_surface.pxd +12 -0
  59. sage/plot/plot3d/parametric_surface.pyx +893 -0
  60. sage/plot/plot3d/platonic.py +601 -0
  61. sage/plot/plot3d/plot3d.py +1442 -0
  62. sage/plot/plot3d/plot_field3d.py +162 -0
  63. sage/plot/plot3d/point_c.pxi +148 -0
  64. sage/plot/plot3d/revolution_plot3d.py +309 -0
  65. sage/plot/plot3d/shapes.cpython-314-x86_64-linux-gnu.so +0 -0
  66. sage/plot/plot3d/shapes.pxd +22 -0
  67. sage/plot/plot3d/shapes.pyx +1382 -0
  68. sage/plot/plot3d/shapes2.py +1512 -0
  69. sage/plot/plot3d/tachyon.py +1779 -0
  70. sage/plot/plot3d/texture.py +453 -0
  71. sage/plot/plot3d/transform.cpython-314-x86_64-linux-gnu.so +0 -0
  72. sage/plot/plot3d/transform.pxd +21 -0
  73. sage/plot/plot3d/transform.pyx +268 -0
  74. sage/plot/plot3d/tri_plot.py +589 -0
  75. sage/plot/plot_field.py +362 -0
  76. sage/plot/point.py +624 -0
  77. sage/plot/polygon.py +562 -0
  78. sage/plot/primitive.py +249 -0
  79. sage/plot/scatter_plot.py +199 -0
  80. sage/plot/step.py +85 -0
  81. sage/plot/streamline_plot.py +328 -0
  82. sage/plot/text.py +432 -0
sage/plot/circle.py ADDED
@@ -0,0 +1,435 @@
1
+ # sage_setup: distribution = sagemath-plot
2
+ """
3
+ Circles
4
+ """
5
+ #*****************************************************************************
6
+ # Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com>,
7
+ # William Stein <wstein@gmail.com>,
8
+ # 2008 Mike Hansen <mhansen@gmail.com>,
9
+ #
10
+ # Distributed under the terms of the GNU General Public License (GPL)
11
+ #
12
+ # This code is distributed in the hope that it will be useful,
13
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
14
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
+ # General Public License for more details.
16
+ #
17
+ # The full text of the GPL is available at:
18
+ #
19
+ # http://www.gnu.org/licenses/
20
+ #*****************************************************************************
21
+ from .primitive import GraphicPrimitive
22
+ from sage.misc.decorators import options, rename_keyword
23
+ from sage.plot.colors import to_mpl_color
24
+ from math import sin, cos, pi
25
+
26
+
27
+ class Circle(GraphicPrimitive):
28
+ """
29
+ Primitive class for the :class:`Circle` graphics type. See ``circle?`` for information
30
+ about actually plotting circles.
31
+
32
+ INPUT:
33
+
34
+ - ``x`` -- `x`-coordinate of center of Circle
35
+
36
+ - ``y`` -- `y`-coordinate of center of Circle
37
+
38
+ - ``r`` -- radius of Circle object
39
+
40
+ - ``options`` -- dictionary of valid plot options to pass to constructor
41
+
42
+ EXAMPLES:
43
+
44
+ Note this should normally be used indirectly via ``circle``::
45
+
46
+ sage: from sage.plot.circle import Circle
47
+ sage: C = Circle(2,3,5,{'zorder':2})
48
+ sage: C
49
+ Circle defined by (2.0,3.0) with r=5.0
50
+ sage: C.options()['zorder']
51
+ 2
52
+ sage: C.r
53
+ 5.0
54
+
55
+ TESTS:
56
+
57
+ We test creating a circle::
58
+
59
+ sage: C = circle((2,3), 5)
60
+ """
61
+ def __init__(self, x, y, r, options):
62
+ """
63
+ Initialize base class Circle.
64
+
65
+ EXAMPLES::
66
+
67
+ sage: C = circle((2,3), 5, edgecolor='red', alpha=.5, fill=True)
68
+ sage: C[0].x
69
+ 2.0
70
+ sage: C[0].r
71
+ 5.0
72
+ sage: C[0].options()['edgecolor']
73
+ 'red'
74
+ sage: C[0].options()['alpha']
75
+ 0.500000000000000
76
+ """
77
+ self.x = float(x)
78
+ self.y = float(y)
79
+ self.r = float(r)
80
+ GraphicPrimitive.__init__(self, options)
81
+
82
+ def get_minmax_data(self):
83
+ """
84
+ Return a dictionary with the bounding box data.
85
+
86
+ EXAMPLES::
87
+
88
+ sage: p = circle((3, 3), 1)
89
+ sage: d = p.get_minmax_data()
90
+ sage: d['xmin']
91
+ 2.0
92
+ sage: d['ymin']
93
+ 2.0
94
+ """
95
+ from sage.plot.plot import minmax_data
96
+ return minmax_data([self.x - self.r, self.x + self.r],
97
+ [self.y - self.r, self.y + self.r],
98
+ dict=True)
99
+
100
+ def _allowed_options(self):
101
+ """
102
+ Return the allowed options for the Circle class.
103
+
104
+ EXAMPLES::
105
+
106
+ sage: p = circle((3, 3), 1)
107
+ sage: p[0]._allowed_options()['alpha']
108
+ 'How transparent the figure is.'
109
+ sage: p[0]._allowed_options()['facecolor']
110
+ '2D only: The color of the face as an RGB tuple.'
111
+ """
112
+ return {'alpha': 'How transparent the figure is.',
113
+ 'fill': 'Whether or not to fill the circle.',
114
+ 'legend_label': 'The label for this item in the legend.',
115
+ 'legend_color': 'The color of the legend text.',
116
+ 'thickness': 'How thick the border of the circle is.',
117
+ 'edgecolor': '2D only: The color of the edge as an RGB tuple.',
118
+ 'facecolor': '2D only: The color of the face as an RGB tuple.',
119
+ 'rgbcolor': 'The color (edge and face) as an RGB tuple.',
120
+ 'hue': 'The color given as a hue.',
121
+ 'zorder': '2D only: The layer level in which to draw',
122
+ 'linestyle': "2D only: The style of the line, which is one of "
123
+ "'dashed', 'dotted', 'solid', 'dashdot', or '--', ':', '-', '-.', "
124
+ "respectively.",
125
+ 'clip': 'Whether or not to clip the circle.'}
126
+
127
+ def _repr_(self):
128
+ """
129
+ String representation of Circle primitive.
130
+
131
+ EXAMPLES::
132
+
133
+ sage: C = circle((2,3), 5)
134
+ sage: c = C[0]; c
135
+ Circle defined by (2.0,3.0) with r=5.0
136
+ """
137
+ return f"Circle defined by ({self.x},{self.y}) with r={self.r}"
138
+
139
+ def _render_on_subplot(self, subplot):
140
+ """
141
+ TESTS::
142
+
143
+ sage: from math import pi
144
+ sage: C = circle((2,pi), 2, edgecolor='black', facecolor='green', fill=True)
145
+ """
146
+ import matplotlib.patches as patches
147
+ from sage.plot.misc import get_matplotlib_linestyle
148
+
149
+ options = self.options()
150
+ p = patches.Circle((float(self.x), float(self.y)), float(self.r), clip_on=options['clip'])
151
+ if not options['clip']:
152
+ self._bbox_extra_artists = [p]
153
+ p.set_linewidth(float(options['thickness']))
154
+ p.set_fill(options['fill'])
155
+ a = float(options['alpha'])
156
+ p.set_alpha(a)
157
+ ec = to_mpl_color(options['edgecolor'])
158
+ fc = to_mpl_color(options['facecolor'])
159
+ if 'rgbcolor' in options:
160
+ ec = fc = to_mpl_color(options['rgbcolor'])
161
+ p.set_edgecolor(ec)
162
+ p.set_facecolor(fc)
163
+ p.set_linestyle(get_matplotlib_linestyle(options['linestyle'],return_type='long'))
164
+ p.set_label(options['legend_label'])
165
+ z = int(options.pop('zorder', 0))
166
+ p.set_zorder(z)
167
+ subplot.add_patch(p)
168
+
169
+ def plot3d(self, z=0, **kwds):
170
+ """
171
+ Plots a 2D circle (actually a 50-gon) in 3D,
172
+ with default height zero.
173
+
174
+ INPUT:
175
+
176
+ - ``z`` -- (optional) 3D height above `xy`-plane
177
+
178
+ EXAMPLES::
179
+
180
+ sage: circle((0,0), 1).plot3d()
181
+ Graphics3d Object
182
+
183
+ This example uses this method implicitly, but does not pass
184
+ the optional parameter z to this method::
185
+
186
+ sage: sum(circle((random(),random()), random()).plot3d(z=random())
187
+ ....: for _ in range(20))
188
+ Graphics3d Object
189
+
190
+ .. PLOT::
191
+
192
+ P = sum([circle((random(),random()), random()).plot3d(z=random()) for _ in range(20)])
193
+ sphinx_plot(P)
194
+
195
+ These examples are explicit, and pass z to this method::
196
+
197
+ sage: from math import pi
198
+ sage: C = circle((2,pi), 2, hue=.8, alpha=.3, fill=True)
199
+ sage: c = C[0]
200
+ sage: d = c.plot3d(z=2)
201
+ sage: d.texture.opacity
202
+ 0.3
203
+
204
+ ::
205
+
206
+ sage: C = circle((2,pi), 2, hue=.8, alpha=.3, linestyle='dotted')
207
+ sage: c = C[0]
208
+ sage: d = c.plot3d(z=2)
209
+ sage: d.jmol_repr(d.testing_render_params())[0][-1]
210
+ 'color $line_1 translucent 0.7 [204,0,255]'
211
+ """
212
+ options = dict(self.options())
213
+ fill = options['fill']
214
+ for s in ['clip', 'edgecolor', 'facecolor', 'fill', 'linestyle',
215
+ 'zorder']:
216
+ if s in options:
217
+ del options[s]
218
+
219
+ n = 50
220
+ dt = float(2*pi/n)
221
+ x, y, r = self.x, self.y, self.r
222
+ xdata = [x+r*cos(t*dt) for t in range(n+1)]
223
+ ydata = [y+r*sin(t*dt) for t in range(n+1)]
224
+ if fill:
225
+ from .polygon import Polygon
226
+ return Polygon(xdata, ydata, options).plot3d(z)
227
+ else:
228
+ from .line import Line
229
+ return Line(xdata, ydata, options).plot3d().translate((0,0,z))
230
+
231
+
232
+ @rename_keyword(color='rgbcolor')
233
+ @options(alpha=1, fill=False, thickness=1, edgecolor='blue', facecolor='blue', linestyle='solid',
234
+ zorder=5, legend_label=None, legend_color=None, clip=True, aspect_ratio=1.0)
235
+ def circle(center, radius, **options):
236
+ """
237
+ Return a circle at a point center = `(x,y)` (or `(x,y,z)` and
238
+ parallel to the `xy`-plane) with radius = `r`. Type
239
+ ``circle.options`` to see all options.
240
+
241
+ OPTIONS:
242
+
243
+ - ``alpha`` -- (default: 1)
244
+
245
+ - ``fill`` -- (default: ``False``)
246
+
247
+ - ``thickness`` -- (default: 1)
248
+
249
+ - ``linestyle`` -- (default: ``'solid'``) (2D plotting only) the style of the
250
+ line, which is one of ``'dashed'``, ``'dotted'``, ``'solid'``, ``'dashdot'``,
251
+ or ``'--'``, ``':'``, ``'-'``, ``'-.'``, respectively
252
+
253
+ - ``edgecolor`` -- (default: ``'blue'``) 2D plotting only
254
+
255
+ - ``facecolor`` -- (default: ``'blue'``) 2D plotting only, useful only
256
+ if ``fill=True``
257
+
258
+ - ``rgbcolor`` -- 2D or 3D plotting. This option overrides
259
+ ``edgecolor`` and ``facecolor`` for 2D plotting
260
+
261
+ - ``legend_label`` -- the label for this item in the legend
262
+
263
+ - ``legend_color`` -- the color for the legend label
264
+
265
+ EXAMPLES:
266
+
267
+ The default color is blue, the default linestyle is solid, but this is easy to change::
268
+
269
+ sage: c = circle((1,1), 1)
270
+ sage: c
271
+ Graphics object consisting of 1 graphics primitive
272
+
273
+ .. PLOT::
274
+
275
+ sphinx_plot(circle((1,1), 1))
276
+
277
+ ::
278
+
279
+ sage: c = circle((1,1), 1, rgbcolor=(1,0,0), linestyle='-.')
280
+ sage: c
281
+ Graphics object consisting of 1 graphics primitive
282
+
283
+ .. PLOT::
284
+
285
+ c = circle((1,1), 1, rgbcolor=(1,0,0), linestyle='-.')
286
+ sphinx_plot(c)
287
+
288
+ We can also use this command to plot three-dimensional circles parallel
289
+ to the `xy`-plane::
290
+
291
+ sage: c = circle((1,1,3), 1, rgbcolor=(1,0,0))
292
+ sage: c
293
+ Graphics3d Object
294
+ sage: type(c)
295
+ <class 'sage.plot.plot3d.base.TransformGroup'>
296
+
297
+ .. PLOT::
298
+
299
+ c = circle((1,1,3), 1, rgbcolor=(1,0,0))
300
+ sphinx_plot(c)
301
+
302
+ To correct the aspect ratio of certain graphics, it is necessary
303
+ to show with a ``figsize`` of square dimensions::
304
+
305
+ sage: c.show(figsize=[5,5],xmin=-1,xmax=3,ymin=-1,ymax=3)
306
+
307
+ Here we make a more complicated plot, with many circles of different colors::
308
+
309
+ sage: g = Graphics()
310
+ sage: step = 6; ocur = 1/5; paths = 16
311
+ sage: PI = math.pi # numerical for speed -- fine for graphics
312
+ sage: for r in range(1,paths+1):
313
+ ....: for x,y in [((r+ocur)*math.cos(n), (r+ocur)*math.sin(n))
314
+ ....: for n in srange(0, 2*PI+PI/step, PI/step)]:
315
+ ....: g += circle((x,y), ocur, rgbcolor=hue(r/paths))
316
+ ....: rnext = (r+1)^2
317
+ ....: ocur = (rnext-r)-ocur
318
+ sage: g.show(xmin=-(paths+1)^2, xmax=(paths+1)^2,
319
+ ....: ymin=-(paths+1)^2, ymax=(paths+1)^2, figsize=[6,6])
320
+
321
+ .. PLOT::
322
+
323
+ g = Graphics()
324
+ step=6; ocur=1/5; paths=16;
325
+ PI = math.pi # numerical for speed -- fine for graphics
326
+ for r in range(1,paths+1):
327
+ for x,y in [((r+ocur)*math.cos(n), (r+ocur)*math.sin(n)) for n in srange(0, 2*PI+PI/step, PI/step)]:
328
+ g += circle((x,y), ocur, rgbcolor=hue(r*1.0/paths))
329
+ rnext = (r+1)**2
330
+ ocur = (rnext-r)-ocur
331
+ g.set_axes_range(-(paths+1)**2,(paths+1)**2,-(paths+1)**2,(paths+1)**2)
332
+ sphinx_plot(g)
333
+
334
+ Note that the ``rgbcolor`` option overrides the other coloring options.
335
+ This produces red fill in a blue circle::
336
+
337
+ sage: circle((2,3), 1, fill=True, edgecolor='blue', facecolor='red')
338
+ Graphics object consisting of 1 graphics primitive
339
+
340
+ .. PLOT::
341
+
342
+ sphinx_plot(circle((2,3), 1, fill=True, edgecolor='blue', facecolor='red'))
343
+
344
+ This produces an all-green filled circle::
345
+
346
+ sage: circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green')
347
+ Graphics object consisting of 1 graphics primitive
348
+
349
+ .. PLOT::
350
+
351
+ sphinx_plot(circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green'))
352
+
353
+ The option ``hue`` overrides *all* other options, so be careful with its use.
354
+ This produces a purplish filled circle::
355
+
356
+ sage: circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green', hue=.8)
357
+ Graphics object consisting of 1 graphics primitive
358
+
359
+ .. PLOT::
360
+
361
+ C = circle((2,3), 1, fill=True, edgecolor='blue', rgbcolor='green', hue=.8)
362
+ sphinx_plot(C)
363
+
364
+ And circles with legends::
365
+
366
+ sage: circle((4,5), 1, rgbcolor='yellow', fill=True,
367
+ ....: legend_label='the sun').show(xmin=0, ymin=0)
368
+
369
+ .. PLOT::
370
+
371
+ C = circle((4,5), 1, rgbcolor='yellow', fill=True, legend_label='the sun')
372
+ C.set_axes_range(xmin=0, ymin=0)
373
+ sphinx_plot(C)
374
+
375
+ ::
376
+
377
+ sage: circle((4,5), 1,
378
+ ....: legend_label='the sun', legend_color='yellow').show(xmin=0, ymin=0)
379
+
380
+ .. PLOT::
381
+
382
+ C = circle((4,5), 1, legend_label='the sun', legend_color='yellow')
383
+ C.set_axes_range(xmin=0, ymin=0)
384
+ sphinx_plot(C)
385
+
386
+ Extra options will get passed on to show(), as long as they are valid::
387
+
388
+ sage: circle((0, 0), 2, figsize=[10,10]) # That circle is huge!
389
+ Graphics object consisting of 1 graphics primitive
390
+
391
+ ::
392
+
393
+ sage: circle((0, 0), 2).show(figsize=[10,10]) # These are equivalent
394
+
395
+ TESTS:
396
+
397
+ We cannot currently plot circles in more than three dimensions::
398
+
399
+ sage: circle((1,1,1,1), 1, rgbcolor=(1,0,0))
400
+ Traceback (most recent call last):
401
+ ...
402
+ ValueError: the center of a plotted circle should have two or three coordinates
403
+
404
+ The default aspect ratio for a circle is 1.0::
405
+
406
+ sage: P = circle((1,1), 1)
407
+ sage: P.aspect_ratio()
408
+ 1.0
409
+
410
+ Verify that :issue:`36153` does not arise::
411
+
412
+ sage: C = circle((1,1), 1, legend_label='test')
413
+ """
414
+ from sage.plot.all import Graphics
415
+
416
+ # Reset aspect_ratio to 'automatic' in case scale is 'semilog[xy]'.
417
+ # Otherwise matplotlib complains.
418
+ scale = options.get('scale', None)
419
+ if isinstance(scale, (list, tuple)):
420
+ scale = scale[0]
421
+ if scale == 'semilogy' or scale == 'semilogx':
422
+ options['aspect_ratio'] = 'automatic'
423
+
424
+ g = Graphics()
425
+ g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
426
+ g.add_primitive(Circle(center[0], center[1], radius, options))
427
+ if options['legend_label']:
428
+ g.legend(True)
429
+ g._legend_colors = [options['legend_color']]
430
+ if len(center) == 2:
431
+ return g
432
+ elif len(center) == 3:
433
+ return g[0].plot3d(z=center[2])
434
+ raise ValueError('the center of a plotted circle should have '
435
+ 'two or three coordinates')