Plotting a Line in 3D from a List of Points

Click For Summary

Discussion Overview

The discussion revolves around the process of plotting a line in 3D space using a list of points. Participants explore methods for visualizing lines defined by pairs of points, including how to handle data from external sources.

Discussion Character

  • Technical explanation
  • Exploratory
  • Homework-related

Main Points Raised

  • One participant inquires about the possibility of plotting a line in 3D from a list of points.
  • Another participant provides a code snippet using two lists of points to create lines in 3D.
  • A participant expresses the need to plot a long list of points from an external file and asks for clarification on how to structure the data for plotting.
  • Another participant suggests using the `Partition` function to group the points into pairs for plotting lines.
  • Expressions of gratitude are shared for the assistance received in the forum.

Areas of Agreement / Disagreement

Participants generally agree on the methods for plotting lines from lists of points, but there are different approaches suggested for handling long lists of points, indicating some uncertainty about the best structure for the data.

Contextual Notes

There are unresolved questions regarding the optimal way to format the input data for plotting, particularly when dealing with long lists of points from external sources.

button_ger
Messages
10
Reaction score
0
Hey.

Is it possible to plot a line in 3D from one point to another?
The source of the points is a list.
 
Physics news on Phys.org
List1 = {{1, 1, 1}, {3, 4, 5}};
List2 = {{-3, 1, 2}, {2, 1, 5}};
L3 = {Line[List1], Line[List2]}
Graphics3D[L3, Axes -> True,
PlotRange -> {{-10, 10}, {-10, 10}, {-10, 10}}]
 
Thank you.

I have a long list with points from an external file. How can i do this?
{{3,6,5},{2,4,1},{3,5,4},{6,7,4},{3,2,1},{1,1,1},...}

Every 2nd point should be the end-point of the line.
Or is it better to make it like this?
{{3,6,5,2,4,1},{3,5,4,6,7,4},{3,2,1,1,1,1},...}
 
Last edited:
button_ger said:
I have a long list with points from an external file. How can i do this?
{{3,6,5},{2,4,1},{3,5,4},{6,7,4},{3,2,1},{1,1,1},...}
If your long list of points is in a variable called dat (i.e. dat={{3,6,5},{2,4,1},{3,5,4},{6,7,4},{3,2,1},{1,1,1}}) then

Graphics3D[Line[Partition[dat,2]]]

will plot the lines
 
great support in this forums.

Thanks a lot DaleSpam.


greets
button
 

Similar threads

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