As @MrFlick already said, you can't calculate a standard error for each x-value. However, there are several option you can consider.
Option 1: plot a loess smooth with a very small span with stat_smooth
in which you can include a shaded area for the standard error:
ggplot(dat, aes(x=pos,y=value, colour=type)) +
stat_smooth(method="loess", span=0.1, se=TRUE, aes(fill=type), alpha=0.3) +
theme_bw()
this gives:
Option 2: as you have a high and a low values for each x
value, you can plot seperate lines for the high and low values. You have to creat a high/low variable first:
dat$level <- rep(c("high","low"), each=120)
ggplot(dat, aes(x=pos,y=value, colour=type)) +
geom_line(aes(linetype=level)) +
theme_bw()
this gives:
Option 3: as you have a high and a low values for each x
value, you can plot a geom_ribbon
between the high and low value with:
ggplot(dat, aes(x=pos,y=value, colour=type)) +
stat_summary(geom="ribbon", fun.ymin="min", fun.ymax="max", aes(fill=type), alpha=0.3) +
theme_bw()
this gives:
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…