Juanchi - 4 months ago 18

R Question

I'm trying to plot multiple fitted lm lines in an only plot:

`library(lme4)`

fits <- lmList(Sepal.Length ~ Petal.Width | Species, data=iris)

coefs <- data.frame(coef(fits)); names(coefs) = c("Int", "slopes")

Then I plot all the fits at once via ggplot:

`ggplot(iris, aes(x = Petal.Width, y=Sepal.Length)) +`

geom_point(shape=1,size = 0.5)+

geom_abline(aes(intercept= Int , slope=slopes), color='grey', data=coefs)

Can someone help me to do it in the basic graphics way?