3
votes

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 ?

2

2 Answers

9
votes

You can simply do

plot dataf using 1:2:($3-$1):($4-$2) with vectors nohead

without changing your original data file.

0
votes

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.