0
我有這樣的數據,其中包含GB和Y值中的X值(以秒爲單位)的幾個數據點。在這個集合之下,它是平均值,最小值和最大值,以及百分位數的5%和95%。這個值是在Excel中計算的。我想繪製類似於這個one的R圖,但也使用折線圖。我在R中創建了這個腳本,繪製了一個線圖,現在我需要添加錯誤欄。我完全無能爲力,我應該如何在R中繪製錯誤條。任何幫助?在錯誤欄中繪製百分位數
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
我的[R腳本
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()