2
I adjusted different models considering the response variable (massaseca) as a function of (time) for each treatment level (content) using the ggplot2 package combined with the stat_poly_eq function.
However, as can be seen in the following graphic, the captions of the estimated lines are superimposed. I would like them to be stacked in the left corner separately. When using the stat_regline_equation function (label.y = 380, label.x = 1000) it is possible to move the legend, however they are still overlaid.
dice: https://drive.google.com/file/d/1Y-GsNNcYINqtO-hcJfNRgaj545JZXZIS/view?usp=sharing
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)
Thanks @Ruibarradas!!!
– user55546