Following code plots the result of an ANCOVA:
library(HH)
ancova(weight ~ gesttime + dose, data=litter)
If I try to make same plot in ggplot, the slopes of the lines of best fit are not homogenous at different levels of the dose
.
library(ggplot2)
ggplot(litter, aes(gesttime, weight)) + geom_point() + facet_grid(. ~ dose) + stat_smooth(method="lm")
How can I make the same plot as outputted by ancova()
, but using ggplot?