passagemath-plot 10.6.31rc3__cp314-cp314-musllinux_1_2_aarch64.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 (78) hide show
  1. passagemath_plot-10.6.31rc3.dist-info/METADATA +172 -0
  2. passagemath_plot-10.6.31rc3.dist-info/RECORD +78 -0
  3. passagemath_plot-10.6.31rc3.dist-info/WHEEL +5 -0
  4. passagemath_plot-10.6.31rc3.dist-info/top_level.txt +2 -0
  5. sage/all__sagemath_plot.py +15 -0
  6. sage/ext_data/threejs/animation.css +195 -0
  7. sage/ext_data/threejs/animation.html +85 -0
  8. sage/ext_data/threejs/animation.js +273 -0
  9. sage/ext_data/threejs/fat_lines.js +48 -0
  10. sage/ext_data/threejs/threejs-version.txt +1 -0
  11. sage/ext_data/threejs/threejs_template.html +597 -0
  12. sage/interfaces/all__sagemath_plot.py +1 -0
  13. sage/interfaces/gnuplot.py +196 -0
  14. sage/interfaces/jmoldata.py +208 -0
  15. sage/interfaces/povray.py +56 -0
  16. sage/plot/all.py +42 -0
  17. sage/plot/animate.py +1796 -0
  18. sage/plot/arc.py +504 -0
  19. sage/plot/arrow.py +671 -0
  20. sage/plot/bar_chart.py +205 -0
  21. sage/plot/bezier_path.py +400 -0
  22. sage/plot/circle.py +435 -0
  23. sage/plot/colors.py +1606 -0
  24. sage/plot/complex_plot.cpython-314-aarch64-linux-musl.so +0 -0
  25. sage/plot/complex_plot.pyx +1446 -0
  26. sage/plot/contour_plot.py +1792 -0
  27. sage/plot/density_plot.py +318 -0
  28. sage/plot/disk.py +373 -0
  29. sage/plot/ellipse.py +375 -0
  30. sage/plot/graphics.py +3580 -0
  31. sage/plot/histogram.py +354 -0
  32. sage/plot/hyperbolic_arc.py +404 -0
  33. sage/plot/hyperbolic_polygon.py +416 -0
  34. sage/plot/hyperbolic_regular_polygon.py +296 -0
  35. sage/plot/line.py +626 -0
  36. sage/plot/matrix_plot.py +629 -0
  37. sage/plot/misc.py +509 -0
  38. sage/plot/multigraphics.py +1294 -0
  39. sage/plot/plot.py +4183 -0
  40. sage/plot/plot3d/all.py +23 -0
  41. sage/plot/plot3d/base.cpython-314-aarch64-linux-musl.so +0 -0
  42. sage/plot/plot3d/base.pxd +12 -0
  43. sage/plot/plot3d/base.pyx +3378 -0
  44. sage/plot/plot3d/implicit_plot3d.py +659 -0
  45. sage/plot/plot3d/implicit_surface.cpython-314-aarch64-linux-musl.so +0 -0
  46. sage/plot/plot3d/implicit_surface.pyx +1453 -0
  47. sage/plot/plot3d/index_face_set.cpython-314-aarch64-linux-musl.so +0 -0
  48. sage/plot/plot3d/index_face_set.pxd +32 -0
  49. sage/plot/plot3d/index_face_set.pyx +1873 -0
  50. sage/plot/plot3d/introduction.py +131 -0
  51. sage/plot/plot3d/list_plot3d.py +649 -0
  52. sage/plot/plot3d/parametric_plot3d.py +1130 -0
  53. sage/plot/plot3d/parametric_surface.cpython-314-aarch64-linux-musl.so +0 -0
  54. sage/plot/plot3d/parametric_surface.pxd +12 -0
  55. sage/plot/plot3d/parametric_surface.pyx +893 -0
  56. sage/plot/plot3d/platonic.py +601 -0
  57. sage/plot/plot3d/plot3d.py +1442 -0
  58. sage/plot/plot3d/plot_field3d.py +162 -0
  59. sage/plot/plot3d/point_c.pxi +148 -0
  60. sage/plot/plot3d/revolution_plot3d.py +309 -0
  61. sage/plot/plot3d/shapes.cpython-314-aarch64-linux-musl.so +0 -0
  62. sage/plot/plot3d/shapes.pxd +22 -0
  63. sage/plot/plot3d/shapes.pyx +1382 -0
  64. sage/plot/plot3d/shapes2.py +1512 -0
  65. sage/plot/plot3d/tachyon.py +1779 -0
  66. sage/plot/plot3d/texture.py +453 -0
  67. sage/plot/plot3d/transform.cpython-314-aarch64-linux-musl.so +0 -0
  68. sage/plot/plot3d/transform.pxd +21 -0
  69. sage/plot/plot3d/transform.pyx +268 -0
  70. sage/plot/plot3d/tri_plot.py +589 -0
  71. sage/plot/plot_field.py +362 -0
  72. sage/plot/point.py +624 -0
  73. sage/plot/polygon.py +562 -0
  74. sage/plot/primitive.py +249 -0
  75. sage/plot/scatter_plot.py +199 -0
  76. sage/plot/step.py +85 -0
  77. sage/plot/streamline_plot.py +328 -0
  78. sage/plot/text.py +432 -0
sage/plot/text.py ADDED
@@ -0,0 +1,432 @@
1
+ # sage_setup: distribution = sagemath-plot
2
+ """
3
+ Text in plots
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 sage.plot.primitive import GraphicPrimitive
22
+ from sage.misc.decorators import options, rename_keyword
23
+ from sage.plot.colors import to_mpl_color
24
+
25
+
26
+ class Text(GraphicPrimitive):
27
+ """
28
+ Base class for Text graphics primitive.
29
+
30
+ TESTS:
31
+
32
+ We test creating some text::
33
+
34
+ sage: text("I like Fibonacci",(3,5))
35
+ Graphics object consisting of 1 graphics primitive
36
+
37
+ .. PLOT::
38
+
39
+ sphinx_plot(text("I like Fibonacci",(3,5)))
40
+ """
41
+ def __init__(self, string, point, options):
42
+ """
43
+ Initialize base class Text.
44
+
45
+ EXAMPLES::
46
+
47
+ sage: T = text("I like Fibonacci", (3,5))
48
+ sage: t = T[0]
49
+ sage: t.string
50
+ 'I like Fibonacci'
51
+ sage: t.x
52
+ 3.0
53
+ sage: t.options()['fontsize']
54
+ 10
55
+ """
56
+ self.string = string
57
+ self.x = float(point[0])
58
+ self.y = float(point[1])
59
+ GraphicPrimitive.__init__(self, options)
60
+
61
+ def get_minmax_data(self):
62
+ """
63
+ Return a dictionary with the bounding box data. Notice
64
+ that, for text, the box is just the location itself.
65
+
66
+ EXAMPLES::
67
+
68
+ sage: T = text("Where am I?",(1,1))
69
+ sage: t=T[0]
70
+ sage: t.get_minmax_data()['ymin']
71
+ 1.0
72
+ sage: t.get_minmax_data()['ymax']
73
+ 1.0
74
+ """
75
+ from sage.plot.plot import minmax_data
76
+ return minmax_data([self.x], [self.y], dict=True)
77
+
78
+ def _repr_(self):
79
+ """
80
+ String representation of Text primitive.
81
+
82
+ EXAMPLES::
83
+
84
+ sage: T = text("I like cool constants", (pi,e)) # needs sage.symbolic
85
+ sage: t = T[0];t # needs sage.symbolic
86
+ Text 'I like cool constants' at the point (3.1415926535...,2.7182818284...)
87
+ """
88
+ return f"Text '{self.string}' at the point ({self.x},{self.y})"
89
+
90
+ def _allowed_options(self):
91
+ """
92
+ Return the allowed options for the Text class.
93
+
94
+ EXAMPLES::
95
+
96
+ sage: T = text("ABC",(1,1),zorder=3)
97
+ sage: T[0]._allowed_options()['fontsize']
98
+ "How big the text is. Either the size in points or a relative size, e.g. 'smaller', 'x-large', etc"
99
+ sage: T[0]._allowed_options()['zorder']
100
+ 'The layer level in which to draw'
101
+ sage: T[0]._allowed_options()['rotation']
102
+ 'How to rotate the text: angle in degrees, vertical, horizontal'
103
+ """
104
+ return {'fontsize': 'How big the text is. Either the size in points or a relative size, e.g. \'smaller\', \'x-large\', etc',
105
+ 'fontstyle': 'A string either \'normal\', \'italic\' or \'oblique\'',
106
+ 'fontweight': 'A numeric value in the range 0-1000 or a string'
107
+ '\'ultralight\', \'light\', \'normal\', \'regular\', \'book\','
108
+ '\'medium\', \'roman\', \'semibold\', \'demibold\', \'demi\','
109
+ '\'bold,\', \'heavy\', \'extra bold\', \'black\'',
110
+ 'rgbcolor': 'The color as an RGB tuple',
111
+ 'background_color': 'The background color',
112
+ 'bounding_box': 'A dictionary specifying a bounding box',
113
+ 'hue': 'The color given as a hue',
114
+ 'alpha': 'A float (0.0 transparent through 1.0 opaque)',
115
+ 'axis_coords': 'If True use axis coordinates: (0,0) lower left and (1,1) upper right',
116
+ 'rotation': 'How to rotate the text: angle in degrees, vertical, horizontal',
117
+ 'vertical_alignment': 'How to align vertically: top, center, bottom',
118
+ 'horizontal_alignment': 'How to align horizontally: left, center, right',
119
+ 'zorder': 'The layer level in which to draw',
120
+ 'clip': 'Whether to clip or not'}
121
+
122
+ def _plot3d_options(self, options=None):
123
+ """
124
+ Translate 2D plot options into 3D plot options.
125
+
126
+ EXAMPLES::
127
+
128
+ sage: T = text("ABC",(1,1))
129
+ sage: t = T[0]
130
+ sage: t.options()['rgbcolor']
131
+ (0.0, 0.0, 1.0)
132
+ sage: s=t.plot3d()
133
+ sage: s.jmol_repr(s.testing_render_params())[0][1]
134
+ 'color atom [0,0,255]'
135
+ """
136
+ if options is None:
137
+ options = dict(self.options())
138
+ options_3d = {}
139
+ for s in ['fontfamily', 'fontsize', 'fontstyle', 'fontweight']:
140
+ if s in options:
141
+ options_3d[s] = options.pop(s)
142
+ # TODO: figure out how to implement rather than ignore
143
+ for s in ['axis_coords', 'clip', 'horizontal_alignment',
144
+ 'rotation', 'vertical_alignment']:
145
+ if s in options:
146
+ del options[s]
147
+ options_3d.update(GraphicPrimitive._plot3d_options(self, options))
148
+ return options_3d
149
+
150
+ def plot3d(self, **kwds):
151
+ """
152
+ Plot 2D text in 3D.
153
+
154
+ EXAMPLES::
155
+
156
+ sage: T = text("ABC", (1, 1))
157
+ sage: t = T[0]
158
+ sage: s = t.plot3d()
159
+ sage: s.jmol_repr(s.testing_render_params())[0][2]
160
+ 'label "ABC"'
161
+ sage: s._trans
162
+ (1.0, 1.0, 0)
163
+ """
164
+ from sage.plot.plot3d.shapes2 import text3d
165
+ options = self._plot3d_options()
166
+ options.update(kwds)
167
+ return text3d(self.string, (self.x, self.y, 0), **options)
168
+
169
+ def _render_on_subplot(self, subplot):
170
+ """
171
+ TESTS::
172
+
173
+ sage: t1 = text("Hello", (1,1), vertical_alignment='top', fontsize=30, rgbcolor='black')
174
+ sage: t2 = text("World", (1,1), horizontal_alignment='left', fontsize=20, zorder=-1)
175
+ sage: t1 + t2 # render the sum
176
+ Graphics object consisting of 2 graphics primitives
177
+ """
178
+ options = self.options()
179
+ opts = {}
180
+ opts['color'] = options['rgbcolor']
181
+ opts['verticalalignment'] = options['vertical_alignment']
182
+ opts['horizontalalignment'] = options['horizontal_alignment']
183
+ if 'background_color' in options:
184
+ opts['backgroundcolor'] = options['background_color']
185
+ if 'fontweight' in options:
186
+ opts['fontweight'] = options['fontweight']
187
+ if 'alpha' in options:
188
+ opts['alpha'] = options['alpha']
189
+ if 'fontstyle' in options:
190
+ opts['fontstyle'] = options['fontstyle']
191
+ if 'bounding_box' in options:
192
+ opts['bbox'] = options['bounding_box']
193
+ if 'zorder' in options:
194
+ opts['zorder'] = options['zorder']
195
+ if options['axis_coords']:
196
+ opts['transform'] = subplot.transAxes
197
+ if 'fontsize' in options:
198
+ val = options['fontsize']
199
+ if isinstance(val, str):
200
+ opts['fontsize'] = val
201
+ else:
202
+ opts['fontsize'] = int(val)
203
+ if 'rotation' in options:
204
+ val = options['rotation']
205
+ if isinstance(val, str):
206
+ opts['rotation'] = options['rotation']
207
+ else:
208
+ opts['rotation'] = float(options['rotation'])
209
+
210
+ p = subplot.text(self.x, self.y, self.string, clip_on=options['clip'], **opts)
211
+ if not options['clip']:
212
+ self._bbox_extra_artists = [p]
213
+
214
+
215
+ @rename_keyword(color='rgbcolor')
216
+ @options(fontsize=10, rgbcolor=(0,0,1), horizontal_alignment='center',
217
+ vertical_alignment='center', axis_coords=False, clip=False)
218
+ def text(string, xy, **options):
219
+ r"""
220
+ Return a 2D text graphics object at the point `(x, y)`.
221
+
222
+ Type ``text.options`` for a dictionary of options for 2D text.
223
+
224
+ 2D OPTIONS:
225
+
226
+ - ``fontsize`` -- how big the text is. Either an integer that
227
+ specifies the size in points or a string which specifies a size (one of
228
+ ``'xx-small'``, ``'x-small'``, ``'small'``, ``'medium'``, ``'large'``,
229
+ ``'x-large'``, ``'xx-large'``).
230
+
231
+ - ``fontstyle`` -- string either ``'normal'``, ``'italic'`` or ``'oblique'``
232
+
233
+ - ``fontweight`` -- a numeric value in the range 0-1000 or a string (one of
234
+ ``'ultralight'``, ``'light'``, ``'normal'``, ``'regular'``, ``'book'``,
235
+ ``'medium'``, ``'roman'``, ``'semibold'``, ``'demibold'``, ``'demi'``,
236
+ ``'bold'``, ``'heavy'``, ``'extra bold'``, ``'black'``)
237
+
238
+ - ``rgbcolor`` -- the color as an RGB tuple
239
+
240
+ - ``hue`` -- the color given as a hue
241
+
242
+ - ``alpha`` -- a float (0.0 transparent through 1.0 opaque)
243
+
244
+ - ``background_color`` -- the background color
245
+
246
+ - ``rotation`` -- how to rotate the text: angle in degrees, vertical, horizontal
247
+
248
+ - ``vertical_alignment`` -- how to align vertically: top, center, bottom
249
+
250
+ - ``horizontal_alignment`` -- how to align horizontally: left, center, right
251
+
252
+ - ``zorder`` -- the layer level in which to draw
253
+
254
+ - ``clip`` -- boolean (default: ``False``); whether to clip or not
255
+
256
+ - ``axis_coords`` -- boolean (default: ``False``); if ``True``, use axis
257
+ coordinates, so that (0,0) is the lower left and (1,1) upper right,
258
+ regardless of the x and y range of plotted values
259
+
260
+ - ``bounding_box`` -- dictionary specifying a bounding box; currently the
261
+ text location
262
+
263
+ EXAMPLES::
264
+
265
+ sage: text("Sage graphics are really neat because they use matplotlib!", (2,12))
266
+ Graphics object consisting of 1 graphics primitive
267
+
268
+ .. PLOT::
269
+
270
+ t = "Sage graphics are really neat because they use matplotlib!"
271
+ sphinx_plot(text(t,(2,12)))
272
+
273
+ Larger font, bold, colored red and transparent text::
274
+
275
+ sage: text("I had a dream!", (2,12), alpha=0.3,
276
+ ....: fontsize='large', fontweight='bold', color='red')
277
+ Graphics object consisting of 1 graphics primitive
278
+
279
+ .. PLOT::
280
+
281
+ sphinx_plot(text("I had a dream!", (2,12), alpha=0.3, fontsize='large', fontweight='bold', color='red'))
282
+
283
+ By setting ``horizontal_alignment`` to 'left' the text is guaranteed to be
284
+ in the lower left no matter what::
285
+
286
+ sage: text("I got a horse and he lives in a tree", (0,0),
287
+ ....: axis_coords=True, horizontal_alignment='left')
288
+ Graphics object consisting of 1 graphics primitive
289
+
290
+ .. PLOT::
291
+
292
+ t = "I got a horse and he lives in a tree"
293
+ sphinx_plot(text(t, (0,0), axis_coords=True, horizontal_alignment='left'))
294
+
295
+ Various rotations::
296
+
297
+ sage: text("noitator", (0,0), rotation=45.0,
298
+ ....: horizontal_alignment='left', vertical_alignment='bottom')
299
+ Graphics object consisting of 1 graphics primitive
300
+
301
+ .. PLOT::
302
+
303
+ sphinx_plot(text("noitator", (0,0), rotation=45.0, horizontal_alignment='left', vertical_alignment='bottom'))
304
+
305
+ ::
306
+
307
+ sage: text("Sage is really neat!!", (0,0), rotation='vertical')
308
+ Graphics object consisting of 1 graphics primitive
309
+
310
+ .. PLOT::
311
+
312
+ sphinx_plot(text("Sage is really neat!!", (0,0), rotation='vertical'))
313
+
314
+ You can also align text differently::
315
+
316
+ sage: t1 = text("Hello", (1,1), vertical_alignment='top')
317
+ sage: t2 = text("World", (1,0.5), horizontal_alignment='left')
318
+ sage: t1 + t2 # render the sum
319
+ Graphics object consisting of 2 graphics primitives
320
+
321
+ .. PLOT::
322
+
323
+ t1 = text("Hello", (1,1), vertical_alignment='top')
324
+ t2 = text("World", (1,0.5), horizontal_alignment='left')
325
+ sphinx_plot(t1 + t2)
326
+
327
+ You can save text as part of PDF output::
328
+
329
+ sage: import tempfile
330
+ sage: with tempfile.NamedTemporaryFile(suffix='.pdf') as f:
331
+ ....: text("sage", (0,0), rgbcolor=(0,0,0)).save(f.name)
332
+
333
+ Some examples of bounding box::
334
+
335
+ sage: bbox = {'boxstyle': "rarrow,pad=0.3", 'fc': "cyan", 'ec': "b", 'lw': 2}
336
+ sage: text("I feel good", (1,2), bounding_box=bbox)
337
+ Graphics object consisting of 1 graphics primitive
338
+
339
+ .. PLOT::
340
+
341
+ bbox = {'boxstyle':"rarrow,pad=0.3", 'fc':"cyan", 'ec':"b", 'lw':2}
342
+ sphinx_plot(text("I feel good", (1,2), bounding_box=bbox))
343
+
344
+ ::
345
+
346
+ sage: text("So good", (0,0), bounding_box={'boxstyle': 'round', 'fc': 'w'})
347
+ Graphics object consisting of 1 graphics primitive
348
+
349
+ .. PLOT::
350
+
351
+ bbox = {'boxstyle':'round', 'fc':'w'}
352
+ sphinx_plot(text("So good", (0,0), bounding_box=bbox))
353
+
354
+ The possible options of the bounding box are 'boxstyle' (one of 'larrow',
355
+ 'rarrow', 'round', 'round4', 'roundtooth', 'sawtooth', 'square'), 'fc' or
356
+ 'facecolor', 'ec' or 'edgecolor', 'ha' or 'horizontalalignment', 'va' or
357
+ 'verticalalignment', 'lw' or 'linewidth'.
358
+
359
+ A text with a background color::
360
+
361
+ sage: text("So good", (-2,2), background_color='red')
362
+ Graphics object consisting of 1 graphics primitive
363
+
364
+ .. PLOT::
365
+
366
+ sphinx_plot(text("So good", (-2,2), background_color='red'))
367
+
368
+ Use dollar signs for LaTeX and raw strings to avoid having to
369
+ escape backslash characters::
370
+
371
+ sage: A = arc((0, 0), 1, sector=(0.0, RDF.pi()))
372
+ sage: a = sqrt(1./2.)
373
+ sage: PQ = point2d([(-a, a), (a, a)])
374
+ sage: botleft = dict(horizontal_alignment='left', vertical_alignment='bottom')
375
+ sage: botright = dict(horizontal_alignment='right', vertical_alignment='bottom')
376
+ sage: tp = text(r'$z_P = e^{3i\pi/4}$',
377
+ ....: (-a, a), **botright)
378
+ sage: tq = text(r'$Q = (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})$',
379
+ ....: (a, a), **botleft)
380
+ sage: A + PQ + tp + tq
381
+ Graphics object consisting of 4 graphics primitives
382
+
383
+ .. PLOT::
384
+
385
+ A = arc((0, 0), 1, sector=(0.0, RDF.pi()))
386
+ a = sqrt(1./2.)
387
+ PQ = point2d([(-a, a), (a, a)])
388
+ botleft = dict(horizontal_alignment='left', vertical_alignment='bottom')
389
+ botright = dict(horizontal_alignment='right', vertical_alignment='bottom')
390
+ tp = text(r'$z_P = e^{3i\pi/4}$', (-a, a), **botright)
391
+ tq = text(r'$Q = (\frac{\sqrt{2}}{2}, \frac{\sqrt{2}}{2})$', (a, a), **botleft)
392
+ sphinx_plot(A + PQ + tp + tq)
393
+
394
+ Text coordinates must be 2D, an error is raised if 3D coordinates are passed::
395
+
396
+ sage: t = text("hi", (1, 2, 3))
397
+ Traceback (most recent call last):
398
+ ...
399
+ ValueError: use text3d instead for text in 3d
400
+
401
+ Use the :func:`text3d <sage.plot.plot3d.shapes2.text3d>` function for 3D text::
402
+
403
+ sage: t = text3d("hi", (1, 2, 3))
404
+
405
+ Or produce 2D text with coordinates `(x, y)` and plot it in 3D (at `z = 0`)::
406
+
407
+ sage: t = text("hi", (1, 2))
408
+ sage: t.plot3d() # text at position (1, 2, 0)
409
+ Graphics3d Object
410
+
411
+ Extra options will get passed on to ``show()``, as long as they are valid. Hence this ::
412
+
413
+ sage: text("MATH IS AWESOME", (0, 0), fontsize=40, axes=False)
414
+ Graphics object consisting of 1 graphics primitive
415
+
416
+ is equivalent to ::
417
+
418
+ sage: text("MATH IS AWESOME", (0, 0), fontsize=40).show(axes=False)
419
+ """
420
+ try:
421
+ x, y = xy
422
+ except ValueError:
423
+ if isinstance(xy, (list, tuple)) and len(xy) == 3:
424
+ raise ValueError("use text3d instead for text in 3d")
425
+ raise
426
+ from sage.plot.all import Graphics
427
+ options['rgbcolor'] = to_mpl_color(options['rgbcolor'])
428
+ point = (float(x), float(y))
429
+ g = Graphics()
430
+ g._set_extra_kwds(Graphics._extract_kwds_for_show(options, ignore='fontsize'))
431
+ g.add_primitive(Text(string, point, options))
432
+ return g