1

我计算了土壤丙酮排放和土壤碳含量之间的线性回归模型,并将其绘制在如下图中:

在此处输入图像描述

我不想在图中显示一个回归模型,而是在同一个图中显示一个用于有机土壤和一个用于矿质土壤。例如用不同的颜色。

有任何想法吗?非常感谢所有帮助!

这是情节的代码:

library(ggplot2)
library(ggpmisc)

 formula <- y~x

(p1 <- ggplot(df, aes(carbon, acetone)) +
    geom_smooth(method = "lm",formula = formula, col="black") +
    geom_point() +
    theme_bw() +
    facet_wrap(~days)+
    stat_poly_eq(
      aes(label = paste(stat(adj.rr.label), stat(p.value.label), sep = "*\", \"*")),
      formula = formula, rr.digits = 1, p.digits = 1, parse = TRUE,size=3.5))

这是数据:

df <- structure(list(carbon = c(22, 19, 21, 3, 45, 25, 24, 72, 1, 63, 
13, 69, 6, 4, 11, 8, 8, 9, 9, 5, 164, 17, 8, 4, 2, 7, 1, 14, 
88, 16, 1, 115, 4, 4, 3, 2, 1, 2, 80, 29, 5, 8, 1, 2, 4, 17, 
19, 7, 22, 19, 21, 3, 45, 25, 1, 63, 13, 69, 6, 4, 11, 8, 8, 
9, 9, 5, 16, 17, 8, 4, 2, 7, 1, 14, 88, 16, 1, 115, 4, 4, 3, 
2, 1, 2, 80, 296, 5, 8, 1, 17, 19, 7), acetone = c(12, 12, 8, 
17, 60, 260, 65, 171, 0, 30, 13, 0, 56, 3619, 
200, 20, 448, 242, 175, 265, 9, 19, 23, 14, 30, 162, 
16, 299, 0, 0, 120, 17, 307, 57, 0, 8, 4, 44, 98, 2, 
10, 385, 91, 130, 21, 12, 65, 181, 3, 5, 0, 44, 24, 11, 
0, 0, 0, 0, 531, 0, 0, 2, 30, 4, 2, 29, 12, 0, 87, 13, 0, 0, 
0, 105, 155, 198, 0, 0, 0, 0, 0, 0, 5, 2, 50, 0, 31, 0, 0, 
126, 70, 0), days = c(10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 10L, 
10L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 
94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 
94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 94L, 
94L, 94L, 94L, 94L, 94L, 94L), soil_type = c("organic", "mineral", 
"organic", "mineral", "mineral", "mineral", "mineral", "organic", 
"mineral", "organic", "mineral", "mineral", "mineral", "mineral", 
"mineral", "mineral", "mineral", "mineral", "mineral", "mineral", 
"organic", "mineral", "mineral", "mineral", "mineral", "mineral", 
"mineral", "mineral", "organic", "mineral", "mineral", "organic", 
"mineral", "mineral", "mineral", "mineral", "organic", "mineral", 
"mineral", "organic", "mineral", "organic", "mineral", "mineral", 
"mineral", "organic", "mineral", "mineral", "organic", "mineral", 
"organic", "mineral", "mineral", "mineral", "mineral", "organic", 
"mineral", "mineral", "mineral", "mineral", "mineral", "mineral", 
"mineral", "mineral", "mineral", "mineral", "organic", "mineral", 
"mineral", "mineral", "mineral", "mineral", "mineral", "mineral", 
"organic", "mineral", "mineral", "organic", "mineral", "mineral", 
"mineral", "mineral", "organic", "mineral", "mineral", "organic", 
"mineral", "organic", "mineral", "organic", "mineral", "mineral"
)), row.names = c(NA, -92L), class = "data.frame")
4

0 回答 0