Error Bars in R – Plot Graph with error bars
plot(expected1[3:15,9], x1, type="b", ylab="Error in Experimental Distance Difference from Reference Acetabular Cup - mm", xlab="Expected Distance Difference from Reference Acetabular Cup - mm", ylim=c(-0.1, 0.1), xlim=c(0.0,0.9), main="Error in Distance Difference - Hip Phantom Scans",sub="Experimental Data", axes=F,pch=15, lty=1)
points(expected1[3:15,9], x2, type="b",pch=17, lty=2)
points(expected1[3:15,9], x3, type="b",pch=17, lty=3)
points(expected1[3:15,9], x4, type="b",pch=18, lty=4)
plotCI(expected1[3:15,9], x1, totalCI, pch=21, pt.bg=par("bg"), add=TRUE)
plotCI(expected1[3:15,9], x2, totalCI, pch=21, pt.bg=par("bg"), add=TRUE)
plotCI(expected1[3:15,9], x3, totalCI, pch=21, pt.bg=par("bg"), add=TRUE)
plotCI(expected1[3:15,9], x4, totalCI, pch=21, pt.bg=par("bg"), add=TRUE)
par(mfrow = c(1, 1))
# Note for docs on plotCI see gplots.pdf and web site given above
box()
axis(1, at=expected1[2:15,9], labels=round(expected1[2:15,9],digits=2), las=1)
axis(2, at=seq(-0.1, 0.1, 0.01),labels=round(seq(-0.1, 0.1, 0.01), digits=2), las=2)
}
Transcript
And we can output those values and, of course, we can plot them, if we build up a plot. We can do our calculations. We compute the confidence intervals. We frame it up; in this case, we're going to make a dataframe that's going to show us one frame. We put a box [and] we place our axes.