Q:

How do I add a transparent arrow that changes color between two points to a plot in R?

Can I use the arrow() function in R to plot a transparent arrow between two points that changes color? For example, an arrow that starts out as red at one point, and gradually changes to blue at the other point (both points are on the same row in a dataframe)? If so, how? And if not, is there another function that can do that in R? 
Here is the piece of code I have until now, which draws points (blue and red) and connects the blue points with the red points with transparent blue arrows:
par(xpd=NA, mfrow=c(1,1), mar=c(4.25,3.2,6.20,3.55))
plot(data$x1,data$y1,col="red",pch=20,cex=0.6,xlim=c(xmin,xmax),ylim=c(ymin,ymax),axes=FALSE,ann=FALSE,xaxt='n',yaxt='n')
par(new=T)
plot(data$x2,data$y2,col="blue",pch=20,cex=0.6,xlim=c(xmin,xmax),ylim=c(ymin,ymax),axes=FALSE,ann=FALSE,xaxt='n',yaxt='n')
par(new=T)
plot(grid.picture(NLmap[-1]),xlim=c(xmin,xmax),ylim=c(ymin,ymax),axes=FALSE,ann=FALSE,xaxt='n',yaxt='n')
par(new=T)

points(data$x1,data$y1,col="red",pch=20,cex=0.25)
par(new=T)
points(data$x2,data$y2,col="blue",pch=20,cex=0.25)
par(new=T)

arrows(data$x1,data$y1, data$x2, data$y2, length = 0.05, angle = 30, 
   code = 2, col = "#9AC0CD40", lty = par("lty"), lwd = par("lwd"))

Hope this helps!

A:

First of all, I should mention that my answer is directly derived from the information provided in the comments and the answer by DWin. I had never seen those functions before, so I thought I would give them a shot. 
I ended up creating a little function that works like arrows except a colour scale is added. I think this is essentially what you want.
require(plotrix)

color.scale.arrow = function(x1,y1,x2,y2,first.col,second.col,
lwd= par('lwd'),lty=par('lty'),angle=30,length=0.25) {
        x=mapply(seq,x1,x2,length.out=256) # Each column is one arrow
        y=mapply(seq,y1,y2,length.out=256) # Each column is one arrow

        arrows(x[255,],y[255,],x[256,],y[256,],
               col=ifelse(y[256,]<y[255,],first.col,second.col),
               lwd=lwd,lty=lty,angle=angle,length=length)

        rgb1=col2rgb(first.col)[,1] / 255
        rgb2=col2rgb(second.col)[,1] / 255
        cols=rbind(rgb1,(rgb1 + rgb2) / 2,rgb2)

        invisible(
              sapply(seq(ncol(x)),function(line) 
                  color.scale.lines(x[,line],y[,line],
                  cols[,'red'],cols[,'green'],cols[,'blue'],
                  lwd=lwd,lty=lty)
              )
       )
}

# Create sample data
set.seed(1)
x <- runif(12); y <- rnorm(12)
i <- order(x,y); x <- x[i]; y <- y[i]
x1=x[s]
x2=x[s+1]
y1=y[s]
y2=y[s+1]

# Plot sample data
plot(x,y, main='', type='n')
color.scale.arrow(x1,y1,x2,y2,'red','blue',lwd=2)

The arrow head will have a colour that matches the 'end' colour given in color.scale.arrow. 

