Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line segments using gnuplot

Tags:

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 ?

like image 257
Arnab Das Avatar asked Nov 16 '25 09:11

Arnab Das


1 Answers

You can simply do

dataf = 'yourfilename.dat'
plot dataf using 1:2:($3-$1):($4-$2) with vectors nohead

without changing your original data file.

like image 118
Karl Avatar answered Nov 18 '25 20:11

Karl