我有10个不同的试验(每个试验都有自己的数据集)。我已经找到了从模型获取的预测值,并使用预测值创建了一个新列。
我通过rbind()
将每个试验的所有x,y和预测的y值限制为一个数据帧。>
我想绘制所有y值的均值,并具有相同的x值(预测值),并使用geom_ribbon而不是误差线来绘制置信区间。
我已经提到了此链接:plotting the means with confidence intervals with ggplot,但是,当我绘制stat_summary(geom="ribbon", fun.data=mean_cl_normal, fun.args=list(conf.int=0.95), fill="lightblue")
时,ggplot不会绘制任何内容,但是它也不会出现任何错误,因此我不确定出了什么问题。
还有另一种方法可以用不同的代码获得相同的结果吗?还是我限制值和数据集的方式有问题?
编辑
0.300 83.69 0.3292044030 0.312 83.69 0.3291121879 0.324 83.69 0.3291012056 0.330 83.69 0.3287549029 0.330 83.61 0.3291187262 0.335 83.57 0.3293862893 0.334 83.36 0.3303592465 0.329 82.79 0.3328754639 0.324 82.55 0.3339801283 0.323 82.92 0.3319657277
这是组合数据
当我使用代码时:
stat_summary(geom="ribbon", fun.data=mean_cl_normal, fun.args=list(conf.int=0.95), fill="lightblue")+
stat_summary(geom = "line", fun = mean, linetype = "dashed")+
stat_summary(geom = "point", fun=mean, color= "red", alpha = I(0.5)) +
ylim(-0.1, 0.6)```
The results came out to be:
[Plot for the ggplot code][1]
[1]: https://i.stack.imgur.com/XuW2G.png
我有10个不同的试验(每个试验都有自己的数据集)。我已经找到了从模型获取的预测值,并使用预测值创建了一个新列。我限制了所有...
欢迎您加入。没有可复制的示例https://stackoverflow.com/help/minimal-reproducible-example,很难回答这个问题。我会尝试geom_smooth选项。这是一个使用geom_smooth绘制可重现间隔的可重现示例,有望使您入门。