简体   繁体   中英

Position dodge with error bars in ggplot2

I am trying to use ggplot to show a series of confidence intervals across different time points. I have two sets of confidence intervals, one parametric and one bootstrap, and I would like to display them using geom_errorbar() . I tried using position_dodge() so the two CI won't directly overlay one another, but it is not working. How do I jitter the CI at the same time point?

pd <- position_dodge(.6)
ggplot(results, aes(x=intervals, y = change)) +
geom_errorbar(aes(ymin=ci.par.low, ymax=ci.par.hi), position = pd, width=.1, colour =
"green") + 
geom_errorbar(aes(ymin=ci.boot.low, ymax=ci.boot.hi),  width=.1, colour = "blue") +
geom_abline(intercept = slope.est, slope = 0, colour = "red") +
labs(title = paste("Protein ID:", prot.name))

尽管很笨重,但我还是用position_jitter()实现了我的目标。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM