I need to find a way to annotate a reference line at the same angle as the reference line itself.
The following statement will produce the reference line and the la
An addendum to @Andrie's answer: instead of hard-coding the aspect ratio in the plot the first time to get the relative coordinate scales, you can recover the current working aspect ratio with the following function:
getCurrentAspect <- function() {
uy <- diff(grconvertY(1:2,"user","inches"))
ux <- diff(grconvertX(1:2,"user","inches"))
uy/ux
}
So you can create your plot: set asp <- getCurrentAspect(); and proceed with the rest of @Andrie's solution.
For all I know this function exists somewhere in the R ecosystem, but I haven't seen it ...