Search code examples
gnuplotline-plot

How to do a 3D line plot in gnuplot using x, y, z data contained in a text file?


I have a text file (named lorenz-phase.txt, as you can probably guess it is the solution to the Lorenz equations) that contains data of the format:

1 1 1
1.01257 1.25992 0.984891
1.04882 1.524 0.973114
1.10721 1.79831 0.965159
1.18687 2.08854 0.961737

and so forth, where the first column is my x values, the second column is my y values and the third column is my z values. I would like to plot a 3D line plot of this data using gnuplot. Is this possible and how is it done? Google has not given me an answer on this front, as the plots I could find were when a parametric function describes the plot.


Solution

  • Use the splot command for 3d plots, and with lines for lines:

    splot "lorenz-phase.txt" using 1:2:3 with lines
    

    My first google result with keywords gnuplot 3d line is this one.