I would like to plot a vector y against x in R where the direction of x is reversed. For example, if
x = c(1,2,3,4)
y = c(10,20,30,40)
plot(x,y)
I would like to have a diagonal in the opposite direction, starting with (4,40) and ending in (1,10).
I thought that rev() would do this, i.e.
plot(rev(x), y)
but this reverses x without y, while
plot(rev(x), rev(y))
is equivalent to the original plot(x,y)
I'm sure there's a very simple way to do this (other than the contrived approach of using -x), but I can't seem to find it.