Take the 2-minute tour ×

I am looking for a way to plot data on population proportion over time, with showing margins or error, similar to this example: http://goo.gl/dbrbu. But could not find any instructions on that. Thanks!

enter image description here

share|improve this question
add comment

2 Answers

A ggplot2 solution:

I'm going to use the US population dataset in R:

population <- data.frame(Year=seq(1790, 1970, length.out=length(uspop)), 
                         Error=rnorm(length(uspop), 5))

ggplot(population, aes(x=Year, y=Population, 
                       ymin=Population-Error, ymax=Population+Error))+
  geom_line(colour="red", size=1.2)+

enter image description here

share|improve this answer
add comment

The plotrix package has plotCI:

 lines(1:10, y)

enter image description here

(A very minor tweak to the example code is to add lines connecting the midpoints.)

share|improve this answer
add comment

Your Answer


