6

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.

2
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.