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/line.py ADDED
@@ -0,0 +1,626 @@
1
+ # sage_setup: distribution = sagemath-plot
2
+ """
3
+ Line plots
4
+ """
5
+
6
+ # *****************************************************************************
7
+ # Copyright (C) 2006 Alex Clemesha <clemesha@gmail.com>,
8
+ # William Stein <wstein@gmail.com>,
9
+ # 2008 Mike Hansen <mhansen@gmail.com>,
10
+ #
11
+ # Distributed under the terms of the GNU General Public License (GPL)
12
+ #
13
+ # This code is distributed in the hope that it will be useful,
14
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
+ # General Public License for more details.
17
+ #
18
+ # The full text of the GPL is available at:
19
+ #
20
+ # http://www.gnu.org/licenses/
21
+ # *****************************************************************************
22
+ from sage.plot.primitive import GraphicPrimitive_xydata
23
+ from sage.misc.decorators import options, rename_keyword
24
+ from sage.plot.colors import to_mpl_color
25
+
26
+
27
+ class Line(GraphicPrimitive_xydata):
28
+ """
29
+ Primitive class that initializes the line graphics type.
30
+
31
+ EXAMPLES::
32
+
33
+ sage: from sage.plot.line import Line
34
+ sage: Line([1,2,7], [1,5,-1], {})
35
+ Line defined by 3 points
36
+ """
37
+ def __init__(self, xdata, ydata, options):
38
+ """
39
+ Initialize a line graphics primitive.
40
+
41
+ EXAMPLES::
42
+
43
+ sage: from sage.plot.line import Line
44
+ sage: Line([-1,2], [17,4], {'thickness':2})
45
+ Line defined by 2 points
46
+ """
47
+ valid_options = self._allowed_options()
48
+ for opt in options:
49
+ if opt not in valid_options:
50
+ raise RuntimeError("error in line(): option '%s' not valid" % opt)
51
+ self.xdata = xdata
52
+ self.ydata = ydata
53
+ GraphicPrimitive_xydata.__init__(self, options)
54
+
55
+ def _allowed_options(self):
56
+ """
57
+ Displayed the list of allowed line options.
58
+
59
+ EXAMPLES::
60
+
61
+ sage: from sage.plot.line import Line
62
+ sage: list(sorted(Line([-1,2], [17,4], {})._allowed_options().items()))
63
+ [('alpha', 'How transparent the line is.'),
64
+ ('hue', 'The color given as a hue.'),
65
+ ('legend_color', 'The color of the legend text.'),
66
+ ('legend_label', 'The label for this item in the legend.'),
67
+ ('linestyle',
68
+ "The style of the line, which is one of '--' (dashed), '-.' (dash dot), '-' (solid), 'steps', ':' (dotted)."),
69
+ ('marker', 'the marker symbol (see documentation for line2d for details)'),
70
+ ('markeredgecolor', 'the color of the marker edge'),
71
+ ('markeredgewidth', 'the size of the marker edge in points'),
72
+ ('markerfacecolor', 'the color of the marker face'),
73
+ ('markersize', 'the size of the marker in points'),
74
+ ('rgbcolor', 'The color as an RGB tuple.'),
75
+ ('thickness', 'How thick the line is.'),
76
+ ('zorder', 'The layer level in which to draw')]
77
+ """
78
+ return {'alpha': 'How transparent the line is.',
79
+ 'legend_color': 'The color of the legend text.',
80
+ 'legend_label': 'The label for this item in the legend.',
81
+ 'thickness': 'How thick the line is.',
82
+ 'rgbcolor': 'The color as an RGB tuple.',
83
+ 'hue': 'The color given as a hue.',
84
+ 'linestyle': "The style of the line, which is one of '--' (dashed), '-.' (dash dot), '-' (solid), 'steps', ':' (dotted).",
85
+ 'marker': "the marker symbol (see documentation for line2d for details)",
86
+ 'markersize': 'the size of the marker in points',
87
+ 'markeredgecolor': 'the color of the marker edge',
88
+ 'markeredgewidth': 'the size of the marker edge in points',
89
+ 'markerfacecolor': 'the color of the marker face',
90
+ 'zorder': 'The layer level in which to draw'
91
+ }
92
+
93
+ def _plot3d_options(self, options=None):
94
+ """
95
+ Translate 2D plot options into 3D plot options.
96
+
97
+ EXAMPLES::
98
+
99
+ sage: L = line([(1,1), (1,2), (2,2), (2,1)], alpha=.5, thickness=10, zorder=2)
100
+ sage: l=L[0]; l
101
+ Line defined by 4 points
102
+ sage: m=l.plot3d(z=2)
103
+ sage: m.texture.opacity
104
+ 0.5
105
+ sage: m.thickness
106
+ 10
107
+ sage: L = line([(1,1), (1,2), (2,2), (2,1)], linestyle=':')
108
+ sage: L.plot3d()
109
+ Traceback (most recent call last):
110
+ ...
111
+ NotImplementedError: invalid 3d line style: ':'
112
+ """
113
+ if options is None:
114
+ options = dict(self.options())
115
+ options_3d = {}
116
+ if 'thickness' in options:
117
+ options_3d['thickness'] = options['thickness']
118
+ del options['thickness']
119
+ if 'zorder' in options:
120
+ del options['zorder']
121
+ if 'linestyle' in options:
122
+ if options['linestyle'] not in ('-', 'solid'):
123
+ raise NotImplementedError("invalid 3d line style: '%s'" %
124
+ (options['linestyle']))
125
+ del options['linestyle']
126
+ options_3d.update(GraphicPrimitive_xydata._plot3d_options(self, options))
127
+ return options_3d
128
+
129
+ def plot3d(self, z=0, **kwds):
130
+ """
131
+ Plots a 2D line in 3D, with default height zero.
132
+
133
+ EXAMPLES::
134
+
135
+ sage: E = EllipticCurve('37a').plot(thickness=5).plot3d() # needs sage.schemes
136
+ sage: F = EllipticCurve('37a').plot(thickness=5).plot3d(z=2) # needs sage.schemes
137
+ sage: E + F # long time (5s on sage.math, 2012), needs sage.schemes
138
+ Graphics3d Object
139
+
140
+ .. PLOT::
141
+
142
+ E = EllipticCurve('37a').plot(thickness=5).plot3d()
143
+ F = EllipticCurve('37a').plot(thickness=5).plot3d(z=2)
144
+ sphinx_plot(E+F)
145
+ """
146
+ from sage.plot.plot3d.shapes2 import line3d
147
+ options = self._plot3d_options()
148
+ options.update(kwds)
149
+ return line3d([(x, y, z) for x, y in zip(self.xdata, self.ydata)], **options)
150
+
151
+ def _repr_(self):
152
+ """
153
+ String representation of a line primitive.
154
+
155
+ EXAMPLES::
156
+
157
+ sage: from sage.plot.line import Line
158
+ sage: Line([-1,2,3,3], [17,4,0,2], {})._repr_()
159
+ 'Line defined by 4 points'
160
+ """
161
+ return "Line defined by %s points" % len(self)
162
+
163
+ def __getitem__(self, i):
164
+ """
165
+ Extract the i-th element of the line (which is stored as a list of points).
166
+
167
+ INPUT:
168
+
169
+ - ``i`` -- integer between 0 and the number of points minus 1
170
+
171
+ OUTPUT: 2-tuple of floats
172
+
173
+ EXAMPLES::
174
+
175
+ sage: L = line([(1,2), (3,-4), (2, 5), (1,2)])
176
+ sage: line_primitive = L[0]; line_primitive
177
+ Line defined by 4 points
178
+ sage: line_primitive[0]
179
+ (1.0, 2.0)
180
+ sage: line_primitive[2]
181
+ (2.0, 5.0)
182
+ sage: list(line_primitive)
183
+ [(1.0, 2.0), (3.0, -4.0), (2.0, 5.0), (1.0, 2.0)]
184
+ """
185
+ return self.xdata[i], self.ydata[i]
186
+
187
+ def __setitem__(self, i, point):
188
+ """
189
+ Set the i-th element of this line (really a sequence of lines
190
+ through given points).
191
+
192
+ INPUT:
193
+
194
+ - ``i`` -- integer between 0 and the number of points on the
195
+ line minus 1
196
+
197
+ - ``point`` -- a 2-tuple of floats
198
+
199
+ EXAMPLES:
200
+
201
+ We create a line graphics object ``L`` and get ahold of the
202
+ corresponding line graphics primitive::
203
+
204
+ sage: L = line([(1,2), (3,-4), (2, 5), (1,2)])
205
+ sage: line_primitive = L[0]; line_primitive
206
+ Line defined by 4 points
207
+
208
+ We then set the 0th point to `(0,0)` instead of `(1,2)`::
209
+
210
+ sage: line_primitive[0] = (0,0)
211
+ sage: line_primitive[0]
212
+ (0.0, 0.0)
213
+
214
+ Plotting we visibly see the change -- now the line starts at `(0,0)`::
215
+
216
+ sage: L
217
+ Graphics object consisting of 1 graphics primitive
218
+ """
219
+ self.xdata[i] = float(point[0])
220
+ self.ydata[i] = float(point[1])
221
+
222
+ def __len__(self):
223
+ r"""
224
+ Return the number of points on this line (where a line is really a sequence
225
+ of line segments through a given list of points).
226
+
227
+ EXAMPLES:
228
+
229
+ We create a line, then grab the line primitive as ``L[0]`` and compute
230
+ its length::
231
+
232
+ sage: L = line([(1,2), (3,-4), (2, 5), (1,2)])
233
+ sage: len(L[0])
234
+ 4
235
+ """
236
+ return len(self.xdata)
237
+
238
+ def _render_on_subplot(self, subplot):
239
+ """
240
+ Render this line on a matplotlib subplot.
241
+
242
+ INPUT:
243
+
244
+ - ``subplot`` -- a matplotlib subplot
245
+
246
+ EXAMPLES:
247
+
248
+ This implicitly calls this function::
249
+
250
+ sage: line([(1,2), (3,-4), (2, 5), (1,2)])
251
+ Graphics object consisting of 1 graphics primitive
252
+ """
253
+ import matplotlib.lines as lines
254
+ options = dict(self.options())
255
+ for o in ('alpha', 'legend_color', 'legend_label', 'linestyle',
256
+ 'rgbcolor', 'thickness'):
257
+ if o in options:
258
+ del options[o]
259
+ p = lines.Line2D(self.xdata, self.ydata, **options)
260
+ options = self.options()
261
+ a = float(options['alpha'])
262
+ p.set_alpha(a)
263
+ p.set_linewidth(float(options['thickness']))
264
+ p.set_color(to_mpl_color(options['rgbcolor']))
265
+ p.set_label(options['legend_label'])
266
+ # we don't pass linestyle in directly since the drawstyles aren't
267
+ # pulled off automatically. This (I think) is a bug in matplotlib 1.0.1
268
+ if 'linestyle' in options:
269
+ from sage.plot.misc import get_matplotlib_linestyle
270
+ p.set_linestyle(get_matplotlib_linestyle(options['linestyle'],
271
+ return_type='short'))
272
+ subplot.add_line(p)
273
+
274
+
275
+ def line(points, **kwds):
276
+ """
277
+ Return either a 2-dimensional or 3-dimensional line depending
278
+ on value of points.
279
+
280
+ INPUT:
281
+
282
+ - ``points`` -- either a single point (as a tuple), a list of
283
+ points, a single complex number, or a list of complex numbers
284
+
285
+ For information regarding additional arguments, see either line2d?
286
+ or line3d?.
287
+
288
+ EXAMPLES::
289
+
290
+ sage: line([(0,0), (1,1)])
291
+ Graphics object consisting of 1 graphics primitive
292
+
293
+ .. PLOT::
294
+
295
+ E = line([(0,0), (1,1)])
296
+ sphinx_plot(E)
297
+
298
+ ::
299
+
300
+ sage: line([(0,0,1), (1,1,1)])
301
+ Graphics3d Object
302
+
303
+ .. PLOT::
304
+
305
+ E = line([(0,0,1), (1,1,1)])
306
+ sphinx_plot(E)
307
+ """
308
+ try:
309
+ return line2d(points, **kwds)
310
+ except ValueError:
311
+ from sage.plot.plot3d.shapes2 import line3d
312
+ return line3d(points, **kwds)
313
+
314
+
315
+ @rename_keyword(color='rgbcolor')
316
+ @options(alpha=1, rgbcolor=(0, 0, 1), thickness=1, legend_label=None,
317
+ legend_color=None, aspect_ratio='automatic')
318
+ def line2d(points, **options):
319
+ r"""
320
+ Create the line through the given list of points.
321
+
322
+ INPUT:
323
+
324
+ - ``points`` -- either a single point (as a tuple), a list of
325
+ points, a single complex number, or a list of complex numbers
326
+
327
+ Type ``line2d.options`` for a dictionary of the default options for
328
+ lines. You can change this to change the defaults for all future
329
+ lines. Use ``line2d.reset()`` to reset to the default options.
330
+
331
+ INPUT:
332
+
333
+ - ``alpha`` -- how transparent the line is
334
+
335
+ - ``thickness`` -- how thick the line is
336
+
337
+ - ``rgbcolor`` -- the color as an RGB tuple
338
+
339
+ - ``hue`` -- the color given as a hue
340
+
341
+ - ``legend_color`` -- the color of the text in the legend
342
+
343
+ - ``legend_label`` -- the label for this item in the legend
344
+
345
+
346
+ Any MATPLOTLIB line option may also be passed in. E.g.,
347
+
348
+ - ``linestyle`` -- (default: ``'-'``) the style of the line, which is one of
349
+ - ``'-'`` or ``'solid'``
350
+ - ``'--'`` or ``'dashed'``
351
+ - ``'-.'`` or ``'dash dot'``
352
+ - ``':'`` or ``'dotted'``
353
+ - ``"None"`` or ``" "`` or ``""`` (nothing)
354
+
355
+ The linestyle can also be prefixed with a drawing style (e.g., ``'steps--'``)
356
+
357
+ - ``'default'`` (connect the points with straight lines)
358
+ - ``'steps'`` or ``'steps-pre'`` (step function; horizontal
359
+ line is to the left of point)
360
+ - ``'steps-mid'`` (step function; points are in the middle of
361
+ horizontal lines)
362
+ - ``'steps-post'`` (step function; horizontal line is to the
363
+ right of point)
364
+
365
+ - ``marker`` -- the style of the markers, which is one of
366
+ - ``"None"`` or ``" "`` or ``""`` (nothing) -- default
367
+ - ``","`` (pixel), ``"."`` (point)
368
+ - ``"_"`` (horizontal line), ``"|"`` (vertical line)
369
+ - ``"o"`` (circle), ``"p"`` (pentagon), ``"s"`` (square), ``"x"`` (x), ``"+"`` (plus), ``"*"`` (star)
370
+ - ``"D"`` (diamond), ``"d"`` (thin diamond)
371
+ - ``"H"`` (hexagon), ``"h"`` (alternative hexagon)
372
+ - ``"<"`` (triangle left), ``">"`` (triangle right), ``"^"`` (triangle up), ``"v"`` (triangle down)
373
+ - ``"1"`` (tri down), ``"2"`` (tri up), ``"3"`` (tri left), ``"4"`` (tri right)
374
+ - ``0`` (tick left), ``1`` (tick right), ``2`` (tick up), ``3`` (tick down)
375
+ - ``4`` (caret left), ``5`` (caret right), ``6`` (caret up), ``7`` (caret down)
376
+ - ``"$...$"`` (math TeX string)
377
+
378
+ - ``markersize`` -- the size of the marker in points
379
+
380
+ - ``markeredgecolor`` -- the color of the marker edge
381
+
382
+ - ``markerfacecolor`` -- the color of the marker face
383
+
384
+ - ``markeredgewidth`` -- the size of the marker edge in points
385
+
386
+ EXAMPLES:
387
+
388
+ A line with no points or one point::
389
+
390
+ sage: line([]) # returns an empty plot
391
+ Graphics object consisting of 0 graphics primitives
392
+ sage: import numpy; line(numpy.array([])) # needs numpy
393
+ Graphics object consisting of 0 graphics primitives
394
+ sage: line([(1,1)])
395
+ Graphics object consisting of 1 graphics primitive
396
+
397
+ A line with numpy arrays::
398
+
399
+ sage: line(numpy.array([[1,2], [3,4]])) # needs numpy
400
+ Graphics object consisting of 1 graphics primitive
401
+
402
+ A line with a legend::
403
+
404
+ sage: line([(0,0),(1,1)], legend_label='line')
405
+ Graphics object consisting of 1 graphics primitive
406
+
407
+ .. PLOT::
408
+
409
+ sphinx_plot(line([(0,0),(1,1)], legend_label='line'))
410
+
411
+ Lines with different colors in the legend text::
412
+
413
+ sage: p1 = line([(0,0),(1,1)], legend_label='line')
414
+ sage: p2 = line([(1,1),(2,4)], legend_label='squared', legend_color='red')
415
+ sage: p1 + p2
416
+ Graphics object consisting of 2 graphics primitives
417
+
418
+ .. PLOT::
419
+
420
+ p1 = line([(0,0),(1,1)], legend_label='line')
421
+ p2 = line([(1,1),(2,4)], legend_label='squared', legend_color='red')
422
+ sphinx_plot(p1 + p2)
423
+
424
+ Extra options will get passed on to show(), as long as they are valid::
425
+
426
+ sage: line([(0,1), (3,4)], figsize=[10, 2])
427
+ Graphics object consisting of 1 graphics primitive
428
+ sage: line([(0,1), (3,4)]).show(figsize=[10, 2]) # These are equivalent
429
+
430
+ We can also use a logarithmic scale if the data will support it::
431
+
432
+ sage: line([(1,2),(2,4),(3,4),(4,8),(4.5,32)],scale='loglog',base=2)
433
+ Graphics object consisting of 1 graphics primitive
434
+
435
+ .. PLOT::
436
+
437
+ sphinx_plot(line([(1,2),(2,4),(3,4),(4,8),(4.5,32)],scale='loglog',base=2))
438
+
439
+ Many more examples below!
440
+
441
+ A blue conchoid of Nicomedes::
442
+
443
+ sage: from math import pi
444
+ sage: L = [[1 + 5*cos(pi/2+pi*i/100),
445
+ ....: tan(pi/2+pi*i/100) * (1+5*cos(pi/2+pi*i/100))] for i in range(1,100)]
446
+ sage: line(L, rgbcolor=(1/4,1/8,3/4))
447
+ Graphics object consisting of 1 graphics primitive
448
+
449
+ .. PLOT::
450
+
451
+ L = [[1+5*cos(pi/2+pi*i/100), tan(pi/2+pi*i/100)*(1+5*cos(pi/2+pi*i/100))] for i in range(1,100)]
452
+ sphinx_plot(line(L, rgbcolor=(1/4,1/8,3/4)))
453
+
454
+ A line with 2 complex points::
455
+
456
+ sage: i = CC(0,1)
457
+ sage: line([1 + i, 2 + 3*i])
458
+ Graphics object consisting of 1 graphics primitive
459
+
460
+ .. PLOT::
461
+
462
+ i = CC(0,1)
463
+ o = line([1+i, 2+3*i])
464
+ sphinx_plot(o)
465
+
466
+ A blue hypotrochoid (3 leaves)::
467
+
468
+ sage: n = 4; h = 3; b = 2
469
+ sage: L = [[n*cos(pi*i/100) + h*cos((n/b)*pi*i/100),
470
+ ....: n*sin(pi*i/100) - h*sin((n/b)*pi*i/100)] for i in range(200)]
471
+ sage: line(L, rgbcolor=(1/4,1/4,3/4))
472
+ Graphics object consisting of 1 graphics primitive
473
+
474
+ .. PLOT::
475
+
476
+ n = 4
477
+ h = 3
478
+ b = 2
479
+ L = [[n*cos(pi*i/100)+h*cos((n/b)*pi*i/100),n*sin(pi*i/100)-h*sin((n/b)*pi*i/100)] for i in range(200)]
480
+ o = line(L, rgbcolor=(1/4,1/4,3/4))
481
+ sphinx_plot(o)
482
+
483
+ A blue hypotrochoid (4 leaves)::
484
+
485
+ sage: n = 6; h = 5; b = 2
486
+ sage: L = [[n*cos(pi*i/100) + h*cos((n/b)*pi*i/100),
487
+ ....: n*sin(pi*i/100) - h*sin((n/b)*pi*i/100)] for i in range(200)]
488
+ sage: line(L, rgbcolor=(1/4,1/4,3/4))
489
+ Graphics object consisting of 1 graphics primitive
490
+
491
+ .. PLOT::
492
+
493
+ L = [[sin(pi*i/100)+sin(pi*i/50),-(1+cos(pi*i/100)+cos(pi*i/50))] for i in range(-100,101)]
494
+ sphinx_plot(line(L, rgbcolor=(1,1/4,1/2)))
495
+
496
+ A red limacon of Pascal::
497
+
498
+ sage: L = [[sin(pi*i/100) + sin(pi*i/50),
499
+ ....: -(1 + cos(pi*i/100) + cos(pi*i/50))] for i in range(-100,101)]
500
+ sage: line(L, rgbcolor=(1,1/4,1/2))
501
+ Graphics object consisting of 1 graphics primitive
502
+
503
+ .. PLOT::
504
+
505
+ L = [[sin(pi*i/100)+sin(pi*i/50),-(1+cos(pi*i/100)+cos(pi*i/50))] for i in range(-100,101)]
506
+ sphinx_plot(line(L, rgbcolor=(1,1/4,1/2)))
507
+
508
+ A light green trisectrix of Maclaurin::
509
+
510
+ sage: L = [[2 * (1-4*cos(-pi/2+pi*i/100)^2),
511
+ ....: 10 * tan(-pi/2+pi*i/100) * (1-4*cos(-pi/2+pi*i/100)^2)] for i in range(1,100)]
512
+ sage: line(L, rgbcolor=(1/4,1,1/8))
513
+ Graphics object consisting of 1 graphics primitive
514
+
515
+ .. PLOT::
516
+
517
+ L = [[2*(1-4*cos(-pi/2+pi*i/100)**2),10*tan(-pi/2+pi*i/100)*(1-4*cos(-pi/2+pi*i/100)**2)] for i in range(1,100)]
518
+ sphinx_plot(line(L, rgbcolor=(1/4,1,1/8)))
519
+
520
+ A green lemniscate of Bernoulli::
521
+
522
+ sage: cosines = [cos(-pi/2+pi*i/100) for i in range(201)]
523
+ sage: v = [(1/c, tan(-pi/2+pi*i/100)) for i,c in enumerate(cosines) if c != 0]
524
+ sage: L = [(a/(a^2+b^2), b/(a^2+b^2)) for a,b in v]
525
+ sage: line(L, rgbcolor=(1/4,3/4,1/8))
526
+ Graphics object consisting of 1 graphics primitive
527
+
528
+ .. PLOT::
529
+
530
+ cosines = [cos(-pi/2+pi*i/100) for i in range(201)]
531
+ v = [(1/c, tan(-pi/2+pi*i/100)) for i,c in enumerate(cosines) if c != 0]
532
+ L = [(a/(a**2+b**2), b/(a**2+b**2)) for a,b in v]
533
+ sphinx_plot(line(L, rgbcolor=(1/4,3/4,1/8)))
534
+
535
+ A red plot of the Jacobi elliptic function `\text{sn}(x,2)`, `-3 < x < 3`::
536
+
537
+ sage: L = [(i/100.0, real_part(jacobi('sn', i/100.0, 2.0)))
538
+ ....: for i in range(-300, 300, 30)]
539
+ sage: line(L, rgbcolor=(3/4, 1/4, 1/8))
540
+ Graphics object consisting of 1 graphics primitive
541
+
542
+ .. PLOT::
543
+
544
+ L = [(i/100.0, real_part(jacobi('sn', i/100.0, 2.0))) for i in range(-300, 300, 30)]
545
+ sphinx_plot(line(L, rgbcolor=(3/4, 1/4, 1/8)))
546
+
547
+ A red plot of `J`-Bessel function `J_2(x)`, `0 < x < 10`::
548
+
549
+ sage: L = [(i/10.0, bessel_J(2,i/10.0)) for i in range(100)]
550
+ sage: line(L, rgbcolor=(3/4, 1/4, 5/8))
551
+ Graphics object consisting of 1 graphics primitive
552
+
553
+ .. PLOT::
554
+
555
+ L = [(i/10.0, bessel_J(2,i/10.0)) for i in range(100)]
556
+ sphinx_plot(line(L, rgbcolor=(3/4,1/4,5/8)))
557
+
558
+ A purple plot of the Riemann zeta function `\zeta(1/2 + it)`, `0 < t < 30`::
559
+
560
+ sage: # needs sage.libs.pari sage.rings.complex_double
561
+ sage: i = CDF.gen()
562
+ sage: v = [zeta(0.5 + n/10 * i) for n in range(300)]
563
+ sage: L = [(z.real(), z.imag()) for z in v]
564
+ sage: line(L, rgbcolor=(3/4, 1/2, 5/8))
565
+ Graphics object consisting of 1 graphics primitive
566
+
567
+ .. PLOT::
568
+
569
+ i = CDF.gen()
570
+ v = [zeta(0.5 + n/10 * i) for n in range(300)]
571
+ L = [(z.real(), z.imag()) for z in v]
572
+ sphinx_plot(line(L, rgbcolor=(3/4,1/2,5/8)))
573
+
574
+ A purple plot of the Hasse-Weil `L`-function `L(E, 1 + it)`, `-1 < t < 10`::
575
+
576
+ sage: # needs lcalc sage.schemes
577
+ sage: E = EllipticCurve('37a')
578
+ sage: vals = E.lseries().values_along_line(1-I, 1+10*I, 100) # critical line
579
+ sage: L = [(z[1].real(), z[1].imag()) for z in vals]
580
+ sage: line(L, rgbcolor=(3/4,1/2,5/8))
581
+ Graphics object consisting of 1 graphics primitive
582
+
583
+ .. PLOT ::
584
+
585
+ E = EllipticCurve('37a')
586
+ vals = E.lseries().values_along_line(1-I, 1+10*I, 100) # critical line
587
+ L = [(z[1].real(), z[1].imag()) for z in vals]
588
+ sphinx_plot(line(L, rgbcolor=(3/4,1/2,5/8)))
589
+
590
+ A red, blue, and green "cool cat"::
591
+
592
+ sage: # needs sage.symbolic
593
+ sage: G = plot(-cos(x), -2, 2, thickness=5, rgbcolor=(0.5,1,0.5))
594
+ sage: P = polygon([[1,2], [5,6], [5,0]], rgbcolor=(1,0,0))
595
+ sage: Q = polygon([(-x,y) for x,y in P[0]], rgbcolor=(0,0,1))
596
+ sage: G + P + Q # show the plot
597
+ Graphics object consisting of 3 graphics primitives
598
+
599
+ .. PLOT::
600
+
601
+ G = plot(-cos(x), -2, 2, thickness=5, rgbcolor=(0.5,1,0.5))
602
+ P = polygon([[1,2], [5,6], [5,0]], rgbcolor=(1,0,0))
603
+ Q = polygon([(-x,y) for x,y in P[0]], rgbcolor=(0,0,1))
604
+ sphinx_plot(G + P + Q)
605
+
606
+ TESTS:
607
+
608
+ Check that :issue:`13690` is fixed. The legend label should have circles
609
+ as markers.::
610
+
611
+ sage: line(enumerate(range(2)), marker='o', legend_label='circle')
612
+ Graphics object consisting of 1 graphics primitive
613
+ """
614
+ from sage.plot.all import Graphics
615
+ from sage.plot.plot import xydata_from_point_list
616
+ points = list(points) # make sure points is a python list
617
+ if not points:
618
+ return Graphics()
619
+ xdata, ydata = xydata_from_point_list(points)
620
+ g = Graphics()
621
+ g._set_extra_kwds(Graphics._extract_kwds_for_show(options))
622
+ g.add_primitive(Line(xdata, ydata, options))
623
+ if options['legend_label']:
624
+ g.legend(True)
625
+ g._legend_colors = [options['legend_color']]
626
+ return g