I have this data that contains several datapoints for the X values in GB and Y values in seconds. Below this set, it is the average, the min and the max, and the percentiles 5% and 95%. This values were calculated in the excel. I would like to plot this graph in R similar to this one, but also with a line graph. I have created this script in R, that plots a line graph, and now I need to add the error bars. I am completely clueless on how should I plot error bars in R. Any help?
1GB 2GB 4GB 8GB
225 173 695 498
332 187 310 1266
112 183 649 581
116 183 305 538
114 481 698 532
111 504 675 551
393 522 311 557
114 488 717 563
363 174 306 488
379 176 437 1348
Average 225.9 307.1 510.3 692.8619883782
Min 111 173 305 488.631612062
Max 393 522 717 1348.73486519
Percentile 95 386.7 513.9 708.45 1311.825555995
Percentile 5 111.45 173.45 305.45 493.2614168165
My R script
add.error.bars <- function(X,Y,SE,w,col=1){
X0 = X; Y0 = (Y-SE); X1 =X; Y1 = (Y+SE);
arrows(X0, Y0, X1, Y1, code=3,angle=90,length=w,col=col);
}
X <- c(1,2,4,8)
meanrandom <- c(226, 307, 510, 693)
# Average
pdf(file="output.pdf") # output file
plot(X, meanrandom,xlab="Input data size (GB)", ylim=c(0,700),ylab="Makespan (seconds)", type="n", panel.first=grid(col="dimgray"))
lines(X,meanrandom,col="black",lty=1,type="o")
legend("topleft",
c("Random"),
lty=c(1), # gives the legend appropriate symbols (lines)
lwd=c(2.5),
col=c("black"))
dev.off()