我使用 ggplot2 函数结合 stat_poly_eq 函数调整了不同的模型,考虑到响应变量 (massaseca) 作为每个治疗水平 (teor) 的 (tempo) 函数。
但是,如下图所示,估计线的图例是重叠的。我希望这些堆叠在左角。当使用 stat_regline_equation 函数 (label.y = 380, label.x = 1000) 时,可以移动图例,但是它们仍然是叠加的。
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)