I want to show the linear equation and the R-squared in the each plot in facet mode. This is my code so far.
library("ggplot2")
datos <- read.table("~/Documents/master2/plots/dosis_todos/datos.dat", header=TRUE, quote="\"")
ggplot(datos, aes(x = corriente, y = dosis, colour = cristal)) +
geom_point() + geom_smooth(method="lm", se=F) +
facet_wrap(~datos$cristal)
After reading about ggpmisc in this answer, I tried
my.formula <- y ~ x
library("ggpmisc")
ggplot(datos, aes(x = corriente, y = dosis, colour = cristal)) +
geom_point() +
geom_smooth(method="lm", se=F, formula=my.formula) +
stat_poly_eq(aes(label = paste(..eq.label.., ..rr.label.., sep = "~~~")), formula = my.formula, parse = TRUE) +
facet_wrap(~datos$cristal)
Which kinda works, except that the position of the equation goes down for every plot until disappears...
If I save my plot big enough, I can see all my text in the 9 plots ....going down.
So I guess the question is how to keep fixed the position of the equation and the R-squared information?
Thanks
Ps. Yes, I know N57 has only 3 points :(
Ps. Here is the link to my data