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
Working example for ggplot2:
slope<-1.3
asp<-1
p <- ggplot()
p<-p+scale_x_continuous(limits = c(1, 15), expand = c(0, 0))
p<-p+scale_y_continuous(limits = c(-8, 20), expand = c(0, 0))
p<-p+geom_abline(intercept = 0, slope = slope)
p<-p+coord_fixed(asp)
p<-p+annotate("text", label = "reference line label", x = 3.5, y = 5, colour = "red",angle=atan(slope*asp)*180/pi)
p
text with angle: 