【发布时间】:2019-02-26 22:05:37
【问题描述】:
test_data <-
data.frame(
var0 = 100 + c(0, cumsum(runif(49, -20, 20))),
var1 = 150 + c(0, cumsum(runif(49, -10, 10))),
var2 = 250 + c(0, cumsum(runif(49, -10, 10)))
)
鉴于以上测试数据,我想做以下事情:
(1) 绘制类似这样的线:Plotting two variables as lines using ggplot2 on the same graph
(2) 为这些线添加一个整体置信带(线可以看成点),类似这样:Find points over and under the confidence interval when using geom_stat / geom_smooth in ggplot2
我知道如何将它们分开,但不确定如何将它们组合在一个情节中。
【问题讨论】:
-
采用“通用方法”as in this answer to plotting multiple lines,然后添加
geom_smooth,并将颜色美学设置为NULL。 -
请将您用于单独绘图的代码添加到您的问题中。