Plotting Pairs of Ordered Pairs in Gnuplot

If I have a data file with 4 columns:

x1, y1, x2, y2,

How can plot a line connecting (x1, y1) to (x2, y2) for each element (row)?

I assume it is pretty easy, but I have been playing around for an hour unsuccessfully.


Solution 1:

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

The vectors style reads four columns (x, y, dx, dy) and draws a vector from (x, y) to (x + dx, y + dy).

nohead prevents gnuplot from drawing the arrow head.