Plotting a Line in 3D from a List of Points

In summary, the conversation is about how to plot a line in 3D from one point to another using a list of points as the source. The recommended method is to use the Graphics3D function with the Line and Partition commands. The conversation also includes gratitude for support in the forum.
  • #1
button_ger
10
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
  • #3
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}}]
 
  • #4
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:
  • #5
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
 
  • #6
great support in this forums.

Thanks a lot DaleSpam.


greets
button
 

Related to Plotting a Line in 3D from a List of Points

1. How can I plot a line in 3D from a list of points?

To plot a line in 3D, you will need to use a specialized software or programming language such as MATLAB, Python, or R. These programs have built-in functions for creating 3D plots and can easily plot a line from a list of points.

2. Can I plot a line in 3D without using specialized software?

While it is possible to create a 3D plot without using specialized software, it can be challenging and time-consuming. It is recommended to use a program specifically designed for 3D plotting to ensure accuracy and efficiency.

3. What is the process for plotting a line in 3D from a list of points?

The process for plotting a line in 3D from a list of points involves setting up the coordinate system, inputting the points into the program, and using the appropriate function to plot the line. The specific steps may vary depending on the software or programming language being used.

4. Can I customize the appearance of the line when plotting in 3D?

Yes, most 3D plotting programs allow for customization of the line's appearance, such as color, thickness, and style. This can be done by specifying the desired parameters in the plotting function or by using additional commands.

5. How can I ensure the accuracy of my 3D plot?

The accuracy of a 3D plot depends on the accuracy of the input data and the precision of the plotting program. To ensure accuracy, it is important to double-check the coordinates of the points and use a reputable 3D plotting program with appropriate settings and parameters.

Similar threads

  • Nuclear Engineering
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
Back
Top