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.

iglvzx
  • 23,459
  • 13
  • 85
  • 122

1 Answers1

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.

Joce
  • 1,020
  • 1
  • 8
  • 19
musiphil
  • 331
  • 3
  • 6