与坡度面积的相关图
Correlation plot with slop area
我有按年龄累积的突变数量和给定年龄的突变中位数,如下所示
> dput(head(data))
structure(list(Age = c(44, 44.8, 47.5, 48.1, 48.8, 50.2), Mutations = c(326.2411348,
218.7943262, 882.9787234, 361.7021277, 901.0638298, 742.1985816
), Age.group = c(40L, NA, NA, NA, NA, 50L), Median.of.mutation.per.age.group = c(576.2411348,
NA, NA, NA, NA, 374.4680851)), row.names = c(NA, 6L), class = "data.frame")
>
我想要这样的情节
其中每个点代表给定年龄(如 40、50、60、70 岁)个体的突变中位数。红线和绿线显示斜率的最佳估计值(即随时间累积的突变);斜率的 95% 置信区间以浅绿色和浅红色阴影显示。
我试过了
cor.test(c(40,50,60,70),c(576.2411348,374.4680851,352.8368794,425.5319149))
Pearson's product-moment correlation
data: c(40, 50, 60, 70) and c(576.2411348, 374.4680851, 352.8368794, 425.5319149)
t = -1.0812, df = 2, p-value = 0.3927
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.9903522 0.8497519
sample estimates:
cor
-0.6073455
这与我真正需要的相去甚远
有什么帮助吗?
您可以在 ggplot2
包中使用 geom_smooth()
。
ggplot(data, aes(x = Age, y = Mutations)) +
geom_point() +
geom_smooth(method = "lm")
您可以将其他参数传递给 geom_point()
和 geom_smooth()
以控制它们的行为。您还可以通过许多其他方式自定义 ggplot 对象。寻找有关如何执行此操作的 ggplot 教程。
我有按年龄累积的突变数量和给定年龄的突变中位数,如下所示
> dput(head(data))
structure(list(Age = c(44, 44.8, 47.5, 48.1, 48.8, 50.2), Mutations = c(326.2411348,
218.7943262, 882.9787234, 361.7021277, 901.0638298, 742.1985816
), Age.group = c(40L, NA, NA, NA, NA, 50L), Median.of.mutation.per.age.group = c(576.2411348,
NA, NA, NA, NA, 374.4680851)), row.names = c(NA, 6L), class = "data.frame")
>
我想要这样的情节
其中每个点代表给定年龄(如 40、50、60、70 岁)个体的突变中位数。红线和绿线显示斜率的最佳估计值(即随时间累积的突变);斜率的 95% 置信区间以浅绿色和浅红色阴影显示。
我试过了
cor.test(c(40,50,60,70),c(576.2411348,374.4680851,352.8368794,425.5319149))
Pearson's product-moment correlation
data: c(40, 50, 60, 70) and c(576.2411348, 374.4680851, 352.8368794, 425.5319149)
t = -1.0812, df = 2, p-value = 0.3927
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
-0.9903522 0.8497519
sample estimates:
cor
-0.6073455
这与我真正需要的相去甚远
有什么帮助吗?
您可以在 ggplot2
包中使用 geom_smooth()
。
ggplot(data, aes(x = Age, y = Mutations)) +
geom_point() +
geom_smooth(method = "lm")
您可以将其他参数传递给 geom_point()
和 geom_smooth()
以控制它们的行为。您还可以通过许多其他方式自定义 ggplot 对象。寻找有关如何执行此操作的 ggplot 教程。