I have a file "a_test.dat" with two data blocks that I can select via the corresponding index.
# first
x1 y1
3 1
6 2
9 8
# second
x2 y2
4 5
8 2
2 7
Now I want to connect the data points of both indices with an arrow.
set arrow from (x1,y1) to (x2,y2).
I can plot both blocks with one plot statement. But I cannot get the points to set the arrows.
plot "a_test.dat" index "first" u 1:2, "" index "second" u 1:2

From version 5.2 you can use gnuplot arrays:
Use
statsto count the number of lines in the file, so that the array can be large enough. Create an arrayxxand anotheryyto hold the data. Useplot ... with tableto read the file again, calling your functionfnset()for each data line with the x and y column values. The function saves them at the current indexi, which it increments. It was initialised to 1.For 3+3 data lines,
iends up at 7, so we setnumito(i-1)/2i.e. 3. Useplot for ... vectorsto draw the arrows. Each arrow needs 4 data items from the array. Note that the second x,y must be a relative delta, not an absolute position.