0

所以我用下面的代码生成了一个带有标准错误的散点图

data <- ddply(dat, .(Value), summarise, 
               N    = length(means),
               mean = mean(means),
               sd   = sd(means),
               se   = sd(means) / sqrt(length(means)) )
ggplot(data, aes(x=Value, y=mean)) + 
    geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=.1) +
    geom_line() +
    geom_point()

这是示例数据

Value  N     mean        sd         se
     1 11 1.624771 0.1788739 0.05393250
     2  6 1.775057 0.2625611 0.10719012
     3 11 2.218854 0.4320835 0.13027807
     4 10 1.745128 0.3922374 0.12403637
     5  9 2.266107 0.1645616 0.05485388

所以我想做的是找到标准错误占据的“区域”,并给出一个标准错误区域占据的图表。这可能吗 ?所以我基本上只想要每个数据点的最大标准误差和最小标准误差所占据的区域

4

1 回答 1

1

使用geom_ribbon

ggplot(data, aes(x=Value, y=mean)) + 
  geom_errorbar(aes(ymin=mean-se, ymax=mean+se), width=.1) +
  geom_ribbon(aes(ymin=mean-se, ymax=mean+se),alpha=0.5) +
  geom_line() +
  geom_point()

在此处输入图像描述

于 2013-04-30T15:22:38.403 回答