Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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