0

在此处输入图像描述

大家好,我想在我的所有图表中添加 p 值和 r^2 值——也标记了。这是我当前的图表代码:

ggplot(CategoryMean_CoverData) + 
  geom_jitter(aes(Year, Cover, colour = Category)) + 
  geom_smooth(aes(Year, Cover, colour = Category), method=lm, se=FALSE) + 
  ggtitle(paste("Average Percent Cover by Category on SCI TNC Plots 1991-98")) +
  facet_wrap(~Category, scales="free_y") + 
  theme(legend.position = "none")

我尝试将其添加到其中以添加标签,但它不起作用。

stat_poly_eq(aes(label = paste(..rr.label..)), label.x = "right", label.y = 0.15, formula = formula, parse = TRUE, size = 3)+ 
  stat_fit_glance(method = 'lm', method.args = list(formula = formula), geom = 'text',aes(label = paste("P-value = ", signif(..p.value.., digits = 4), sep = "")), label.x = 'right', label.y = 0.35, size = 3) 

有什么建议么?

4

0 回答 0