I have a series of regressions wrapped into facet_wrap and I'm wondering whether it is possible to denote the text for significant pvals with red text or a "*" inside of the stat_poly_eq() [ggpmisc] function?
Here is my sample code
ggplot(my.data, aes(x=age, y=logRR))+
geom_hline(yintercept=0, linetype="dashed", color = "gray", size = 0.5) +
geom_ribbon(aes(ymax=eCI_95, ymin=eCI_5), group=1, alpha=0.2, fill = "#BC1605") +
geom_point(shape=19, size=3, color = "#BC1605") +
geom_smooth(method='lm', se = T, formula=y~x, linetype='solid', size=0.5) +
stat_poly_eq(formula = y ~ x,
aes(label = paste(..rr.label.., ..p.value.label.., sep = "*`,`~")),
parse = TRUE,
label.x.npc = "right",
vstep = 0.05) + # sets vertical spacing
scale_color_manual(values=c("#000000", "#A4A4A4"), drop = FALSE) +
scale_linetype_manual(values=c("solid","twodash"), drop = FALSE) +
labs(y=expression(bold(Log(Diversity[MPA]/Diversity[REF])))) +
labs(colour = 'Difference', linetype = 'Slope') +
facet_wrap(mlpa_region~group, scales="free_y", nrow=3)+
scale_x_continuous(breaks = seq(from=-5, to=19, by=2))+
theme_classic()
Yes, you can set colors with the ggtext package.
Created on 2022-06-02 by the reprex package (v2.0.1)