Mathematica Spatial 3-D List Plot

  • Context: Mathematica 
  • Thread starter Thread starter brydustin
  • Start date Start date
  • Tags Tags
    List Mathematica Plot
Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
4 replies · 4K views
brydustin
Messages
201
Reaction score
0
I want to plot a list of points where each element is of the form {x,y,z} so that the list is like:

{ {x1,y1,z1} , {x2,y2,z2} , ... , {xN,yN,zN} }.

And I want to connect a line between each consectutive pair (i.e. {x(i-1),y(i-1),z(i-1)} & {x(i),y(i),z(i)} ).

Unfortunately, its not as simple as ListLinePlot[List, Joined -> True], what this will do is take each {x(j),y(j),z(j)} and plot them each as separate lines each with 3 points in 2-D space.

Also, its not as simple as ListPlot3D[List, Joined -> True]
Because the Joined function is not defined in 3-D. But surely there is a way around this?
...
 
Physics news on Phys.org
DaleSpam said:
Assuming your list is stored in a variable named dat:

Graphics3D[Line[dat]]

Now that I know the name of the function, I'm not sure how I might plot two sets of data, like dat1 and dat2 where the lines are color1 and color2, for example.
 
DaleSpam said:
I think they have examples in the online help for Line.

Specifically, I wanted to know how to have multiple different colored lines in a box, but what they show is how to have multiple sets of lines with different colors however not in the same box, their example:

l = Line[{{1, 1, -1}, {2, 2, 1}, {3, 3, -1}, {4, 4, 1}}];
{Graphics3D[{Dashed, l}], Graphics3D[{Pink, l}],
Graphics3D[{Thick, l}], Graphics3D[{Thick, Dashed, Pink, l}]}

Which makes four boxes, I want one box with 4 lines each with a different color, for example.