I am trying to extend the lm line beyond the range of the data when plotting using geom_smooth. However, setting fullrange=TRUE doesn't seem to do the trick.
I have set the xlim beyond the data range using coord_cartesian and scale_x_log10 as shown in the code.
library(ggplot2)
df<-data.frame(Time=c(1:9 %o% 10^(2:3),10^4),Shift=seq(0.01,0.03,length.out=19),Treatment=2.2)
df<-rbind(df,data.frame(Time=c(1:9 %o% 10^(2:3),10^4),Shift=seq(0.02,0.06,length.out=19),Treatment=2.4))
df<-rbind(df,data.frame(Time=c(1:9 %o% 10^(2:3),10^4),Shift=seq(0.06,0.14,length.out=19),Treatment=2.6))
df<-rbind(df,data.frame(Time=c(1:9 %o% 10^(2:3),10^4),Shift=seq(0.09,0.22,length.out=19),Treatment=2.8))
myPlot <- ggplot(df,aes(x=Time,y=Shift,col=as.factor(Treatment))) +
scale_y_log10(breaks = c(1 %o% 10^(-2:1)), minor_breaks = c(1:9 %o% 10^(-1:2)),labels=paste0(c(1 %o% 10^(0:3)),"%")) +
scale_x_log10(breaks = c(1 %o% 10^(2:9)), minor_breaks = c(1:9 %o% 10^(0:10))) +
labs(color="Treatment") +
coord_cartesian(xlim=c(100,1E9),ylim=c(0.001,1))+
theme_bw() +
annotation_logticks() +
geom_point()+
geom_smooth(method="lm",fullrange=TRUE)
plot(myPlot)
The lm line stops at the end of the data: