Mathematica Mathematica Connecting Plot Points

Click For Summary
To connect successive points in three-dimensional space using Mathematica, the discussion highlights the transition from older plotting functions to newer ones. While ListPlot was previously used with the PlotJoined option to connect points in two dimensions, this option is no longer available in version 8 and has been replaced by ListLinePlot. However, for three-dimensional plotting, ListPlot3D does not support the PlotJoined option either. The correct approach for plotting connected points in 3D involves using ListLinePlot in conjunction with the appropriate data structure. For example, generating a random walk in three dimensions can be done with RandomReal to create the points, and then using ListLinePlot to visualize the connections between them. The challenge lies in ensuring the data is formatted correctly for the new plotting functions to avoid errors.
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:

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 1 ·
Replies
1
Views
7K
  • · Replies 6 ·
Replies
6
Views
3K