I'm not sure that you are drawing a slope, as it seems that you are using a bar. There are three ways to do this, I will illustrate two. If you have actual xy data and want to put separate regression lines on the edge, just use stat_smooth(method="lm") . Here is the code:
library(ggplot2) x <- rnorm(100) y <- + .7*x + rnorm(100) f1 <- as.factor(c(rep("A",50),rep("B",50))) f2 <- as.factor(rep(c(rep("C",25),rep("D",25)),2)) df <- data.frame(cbind(x,y)) df$f1 <- f1 df$f2 <- f2 ggplot(df,aes(x=x,y=y))+geom_point()+facet_grid(f1~f2)+stat_smooth(method="lm",se=FALSE)
This gives:

Or you can use the geom_abline() command to set your own interception and tilt. Here's an example of using a diamond dataset superimposed on a bar chart, perhaps what you are looking for.

You can see an example using the diagrams with this fragment ggplot(df,aes(x=x,y=y))+geom_point()+facet_grid(f1~f2)+geom_abline(intercept = 0, slope = 1 )
source share