Mathematica Connecting Plot Points

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
2 replies · 8K views
brydustin
Messages
201
Reaction score
0
Given a set of points in a list how can you not only plot them (which I know how to do) but how can you connected a line between each successive pair of points.


i.e. { {Point1},{Point2},{Point3},...{PointN} } so that Point 1 has a straight line connecting to Point2, 2 to 3, 3 to 4,... K to K+1,..., and N-1 to N.

Where each point has x,y, and z "space" components.
 
Physics news on Phys.org
I meant how do I do this in 3-dimensions, your response was restricted to two-dimensions and it doesn't appear to work in three.

For example,
RandomWalk = RandomReal[{-1, 1}, {30, 3}];
ListPlot[Accumulate[RandomWalk],PlotJoined->True]
causes an error, whereas
RandomWalk = RandomReal[{-1, 1}, {30, 2}];
ListPlot3D[Accumulate[RandomWalk],PlotJoined->True]
does not.
Bill Simpson said:
In older versions of Mathematica

ListPlot[{{1,1},{2,2},{3,1}},PlotJoined->True]

In version 8 according to http://reference.wolfram.com/mathematica/ref/ListPlot.html there is no longer a PlotJoined option for ListPlot and they have apparently replaced this with a new function ListLinePlot

http://reference.wolfram.com/mathematica/tutorial/PlottingListsOfData.html
 
Last edited: