Line
Line[{p1,p2,…}]
represents the line segments joining a sequence for points pi.
Line[{{p11,p12,…},{p21,…},…}]
represents a collection of lines.
Details and Options
- Line is also known as poly-line or line-segments.
- Line can be used as a geometric region or a graphics primitive.
- Line represents a piecewise linear curve where the segment from pi to pi+1 is given by .
- Line can be used in Graphics and Graphics3D.
- In graphics, the points pi can be Scaled, Offset, ImageScaled, and Dynamic expressions.
- Graphics rendering is affected by directives such as Thickness, Dashing, JoinForm, CapForm, and color.
- The following options and settings can be used in graphics:
-
VertexColors None vertex colors to be interpolated VertexNormals None effective vertex normals for shading - Line can be used with symbolic points in GeometricScene.
Background & Context
- Line is a graphics and geometry primitive that represents a geometric line segment or sequence of connected line segments (a "poly-line"). The location of a Line connecting points in -dimensional space is specified as a list argument consisting of sublists, with each sublist containing Cartesian coordinate values. The coordinate sublists of Line objects may consist of exact or approximate values, where RegionEmbeddingDimension can be used to determine the dimension for a given Line expression. A collection of lines (or poly-lines) may be represented as a nested lists of -tuples inside a single Line primitive (a "multiline"). The coordinates of Line objects may have exact or approximate values.
- Line objects can be visually formatted in two and three dimensions using Graphics and Graphics3D, respectively. Line objects can also be used in geographical maps using GeoGraphics and GeoPosition (e.g. GeoGraphics[Line[GeoPosition[{{38.9,-77.0},{40.1,-88.3}}]]]). In addition, Line may serve as a region specification over which a computation should be performed.
- While lines themselves have dimension 1 (as reported by the RegionDimension function) with zero thickness, Line objects in formatted graphics expressions are by default styled to appear "thicker" than a one-dimensional mathematical line. Furthermore, in graphical visualizations, lines are displayed at the same size regardless of varying distances from the view point. The appearance of Line objects in graphics can be modified by specifying thickness directives such as Thickness, AbsoluteThickness, Thick, and Thin; dashing directives such as Dashing, AbsoluteDashing, Dashed, Dotted, and DotDashed; edge and cap directives EdgeForm and CapForm; color directives such as Red; the transparency directive Opacity; and the style option Antialiasing. In addition, the colors of multilines may be specified using VertexColors, while the shading and simulated lighting of multilines within Graphics3D may be specified using VertexNormals.
- GeometricTransformation and more specific transformation functions such as Translate and Rotate can be used to change the coordinates at which a Line object is displayed while leaving the underlying Line expression untouched.
- Other graphics primitives such as Tube, Arrow, HalfLine, and InfiniteLine may resemble those of stylized Line objects. While poly-lines consist only of straight line segments, smooth curves may be constructed via splines using BSplineCurve or BezierCurve or via an interpolating function using Interpolation. A function related to Line as a geometric region is Interval, which interprets pairs of numbers as endpoints of a line segment lying on the number line and which can be directly operated on using arithmetic and relational operators.
- While the Line primitive explicitly appears in graphics and geometric region specification expressions, it should be noted that coordinates are commonly represented as bare lists in other contexts in the Wolfram Language. However, a number of graphics functions including Plot, ParametricPlot, ParametricPlot3D, and ContourPlot return graphical expressions that explicitly include Line objects.
Examples
open allclose allBasic Examples (4)
Compute the ArcLength of a line:
Scope (24)
Graphics (14)
Specification (3)
Styling (8)
Lines with different thicknesses:
Thickness in printer's points:
Line caps can be specified using CapForm:
Joining of line segments can be specified using JoinForm:
Colors can be specified at vertices using VertexColors:
Normals can be specified at vertices using VertexNormals for 3D lines:
Coordinates (3)
Options (3)
Applications (6)
Properties & Relations (4)
Several visualization functions produce Line objects:
Use directive styles appropriate for lines:
You can also transform the output:
This shows the points at which it was sampled:
ImplicitRegion can be used to represent any Line region:
ParametricRegion can be used to represent any Line region:
Possible Issues (1)
Line objects need to be specified using numbers that can be represented by machine numbers:
Text
Wolfram Research (1988), Line, Wolfram Language function, https://reference.wolfram.com/language/ref/Line.html (updated 2014).
CMS
Wolfram Language. 1988. "Line." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2014. https://reference.wolfram.com/language/ref/Line.html.
APA
Wolfram Language. (1988). Line. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Line.html