[R] Polygon

Steven Yen @tyen @end|ng |rom ntu@edu@tw
Sun Oct 21 20:46:34 CEST 2018


David, Rui, and All:
Greetings.
1. I need a helping hand with the polygon statement below so that I can 
have the area under the curve highlighted, between (z1,z2).
2. Is it possible to label the X-axis with in two scale, in the current 
z-scale and another, say x = (z+5)*2?
Thank you.

z1<- -1
z2<-  2
curve(dnorm(x,0,1),xlim=c(-4,4),main="Standard 
Normal",xaxt="n",frame=F,xlab="z")
jj<-seq(z1,z2,0.01)
cord.x<-c(jj)
cord.y<-c(dnorm(jj))
#polygon(cord.x,cord.y,col="skyblue")
axis(1,at=c(-5,z1,0,z2,5),lab=c(-5,z1,0,z2,5))
abline(v=c(z1,z2))

-- 
styen using ntu.edu.tw (S.T. Yen)


	[[alternative HTML version deleted]]




More information about the R-help mailing list