I'm wondering how to fully cover a cylindrical area between two curves using some color? Right now, I've tried using rect()
but there remain two tiny white spaces above and below the rect()
that I don't know how to cover?
Here is my current R code:
curve(dnorm(x), -1.96, 1.96, bty="n", ann=F, axes=F, xaxs="i", yaxs="i")
curve(-dnorm(x), -1.96, 1.96, add=TRUE)
rect(-.5, -dnorm(-.5), .5, dnorm(.5), col="red" ) # How can I fill-up the white space
# above and below the rectangle?
axis(1, at=c(-1.96,0,1.96),mgp=c(2, .6, .45), tcl=F )
Also, Here is a picture showing the top white space and the bottom white space: