I am trying to use geom_abline
with facet_grid
where I have 4 months in a categorical variable and 4 lakes in a categorical variable giving a 16 panel grid. I have already built the slopes and intercepts using coef(summary(lm))
from 4 different lm
models. Is it possible to specify which panels in the facet_grid
I want to add the geom_abline
to? I have added some dummy data to get an idea of what I am trying to do, but think of all 16 panels having multiple data points rather than 4 of them having one..
df1 <- data.frame(month =c("May","June","September","October"),
lake = c("L1","L2","L3","L4"),
var1 = c(10,9,8,9),
var2 = c(11,9,8,9)
)
gridfig <- ggplot(df1, aes(var2,var1))+
facet_grid(rows = vars(month), cols = vars(lake))+
geom_point(size = 2)
Any advice would be much appreciated.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.