I adjusted different models considering the response variable (massaseca) as a function of (tempo) for each treatment level (teor) using the ggplot2 function combined with the stat_poly_eq function.
However, as can be seen in the graph below, the legends of the estimated lines are overlapping. I would like these to be stacked in the left corner. When using the stat_regline_equation function (label.y = 380, label.x = 1000) it is possible to move the legend, however, they are still superimposed.
library(ggplot2)
library(ggpubr)
library(ggpmisc)
my.formula <- y ~ x
ggplot(dadosnew, aes(x = Tempo, y = massaseca, group = interaction(Fator,Trat),
color=interaction(Fator,Trat))) +
stat_summary(geom = "point", fun = mean) +
stat_smooth(method = "lm", se=FALSE, formula=y ~ poly(x, 1, raw=TRUE)) +
stat_poly_eq(formula = my.formula,eq.with.lhs = "As-italic(hat(y))~`=`~",
aes(label = paste(..eq.label.., ..rr.label.., sep = "*plain(\",\")~")),
parse = TRUE, size = 5, label.y = 35)+
labs(title = "",
x = "Time (Minutes)",
y = "Weight (mg)") + theme_bw() +
theme(axis.title = element_text(size = 23,color="black"),
axis.text = element_text(size = 18,color="black"),
text = element_text(size = 20,color="black")) + facet_wrap(~Fator)