Search code examples
gnuplot

Line segments using gnuplot


I have a data file like in four columns representing x1, y1, x2, y2.

e.g

1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7

etc.

Now I want to plot line segments using (x1,y1) and (x2,y2) as end points of the line segments. Thus I shall get 4 line segments from the above data file.

How can I achieve this using gnuplot ?


Solution

  • You can do this easily.

    1 2
    3 4
    
    2 3
    4 5
    ...
    

    does this. You just need to add an extra line between each set of cordinates.

    Hope this hepls.