图形中的R程序

图形中的R程序

问题描述:

所以基本上,我有我使用做一些线图图形中的R程序

f x N  y   sd   se   ci   
1 Carla 1 5 0.577437500 0.538098341 0.240644894 0.668137337 
2 Carla 2 21 1.975978653 3.258871642 0.711144094 1.483420586 
3 Carla 3 8 1.217090357 1.936489842 0.684652549 1.618946022 
4 Carla 4 6 0.004543219 0.002500954 0.001021010 0.002624590 
5 Liam 1 4 0.356406250 0.203422619 0.101711309 0.323690780 
6 Liam 2 8 5.164708412 5.169434477 1.827671087 4.321755376 
7 Liam 3 4 0.019294020 0.002592634 0.001296317 0.004125459 
8 Meg 1 3 0.337395833 0.383621255 0.221483835 0.952968025 
9 Meg 2 11 2.218085777 3.889646592 1.172772574 2.613100136 
10 Meg 3 3 2.239833477 3.810413346 2.199943171 9.465591491 
11 Meg 4 3 0.004317894 0.002512864 0.001450803 0.006242301 

该R输出,我用下面的代码,做一些线图:

# Standard error of the mean 
ggplot(dfc, aes(x=x, y=y, colour=f)) + 
    geom_errorbar(aes(ymin=y-se, ymax=y+se), width=.1) + 
    geom_line() + 
    geom_point() 

# The errorbars overlapped, so use position_dodge to move them horizontally 
pd <- position_dodge(.1) # move them .05 to the left and right 

ggplot(dfc, aes(x=x, y=y, colour=f)) + 
    geom_errorbar(aes(ymin=y-se, ymax=y+se), width=.1, position=pd) + 
    geom_line(position=pd) + 
    geom_point(position=pd) 

但我想知道是否可以“突出”标准错误和东西占用的区域。

+0

你是什么意思突出该地区?填充由置信区间限制的区域(带)? – agstudy

+0

是的!这是一个更好的方式来说:D –

+0

所以请编辑你的问题,并澄清/精确。 – agstudy

ggplot(dfc, aes(x=x, y=y, colour=f, fill=f, ymin=y-se, ymax=y+se)) + 
    geom_ribbon(aes(colour=NULL),alpha=0.5) + 
    geom_errorbar(width=.1) + 
    geom_line() + 
    geom_point()