diff --git a/mathics/builtin/box/graphics.py b/mathics/builtin/box/graphics.py index 52a34e2c7..2e5e40d35 100644 --- a/mathics/builtin/box/graphics.py +++ b/mathics/builtin/box/graphics.py @@ -1034,7 +1034,9 @@ def extent(self): class LineBox(_Polyline): - # Boxing methods for a list of Line. + """ + Boxing methods for a list of Lines. + """ def init(self, graphics, style, item=None, lines=None): super(LineBox, self).init(graphics, item, style) diff --git a/mathics/builtin/drawing/plot.py b/mathics/builtin/drawing/plot.py index e4e556c09..4a38b9980 100644 --- a/mathics/builtin/drawing/plot.py +++ b/mathics/builtin/drawing/plot.py @@ -2348,7 +2348,9 @@ def _apply_fn(self, f: Callable, x_value): class ParametricPlot(_Plot): """ - :WMA link: https://reference.wolfram.com/language/ref/ParametricPlot.html + + :WMA link + : https://reference.wolfram.com/language/ref/ParametricPlot.html
'ParametricPlot[{$f_x$, $f_y$}, {$u$, $umin$, $umax$}]'
plots a parametric function $f$ with the parameter $u$ ranging from $umin$ to $umax$. diff --git a/mathics/builtin/graphics.py b/mathics/builtin/graphics.py index a0f01cc64..31142ab7a 100644 --- a/mathics/builtin/graphics.py +++ b/mathics/builtin/graphics.py @@ -343,6 +343,14 @@ def convert(content): class _Polyline(_GraphicsElementBox): + """ + A structure containing a list of line segments + stored in ``self.lines`` created from + a list of points. + + Lines are formed by pairs of consecutive point. + """ + def do_init(self, graphics, points): if not points.has_form("List", None): raise BoxExpressionError @@ -356,6 +364,10 @@ def do_init(self, graphics, points): ): elements = points.elements self.multi_parts = True + elif len(points.elements) == 0: + # Ensure there are no line segments if there are no points. + self.lines = [] + return else: elements = [ListExpression(*points.elements)] self.multi_parts = False