Here is one way to do this with the excellent ggplot2
package.
require(ggplot2) require(reshape) # Load data data = read.table('data.txt', header=T) # Format data data = melt(data, id.vars=c('id', 'factor'), variable_name='time') data$time = as.numeric(gsub('H(.+)', '\\1', data$time)) # Function to summarize y at each x getband <- function(y.in){ ymax = mean(y.in) + sd(y.in) ymin = mean(y.in) - sd(y.in) data.frame(ymax, ymin) } # Plot dev.new(width=5, height=4) qplot(time, value, group=factor, geom='point', color=factor, fill=factor, data=data) + stat_summary(color=0, fun.data=getband, geom='ribbon', alpha=0.2) + stat_summary(fun.y=mean, geom='line')
source share