polygon():draw the polygons where vertices are given in x and y.
polygon(x,y=NULL,density=NULL,angle=45,border=NULL,col=NA,lty=par("lty"),...,fillOddEven=FALSE)
·density:the density of shading lines,in lines per inch.
缺省值指没有画shading lines。
·angle:shading lines的角度,用度数值来表示。
·col:填充颜色。
·border:画边界的颜色。
·fillOddEven:logical controlliing the polygon shading mde.
例1:
> par(mfrow=c(1,3)) > x<-mtcars$mpg > plot(x) > polygon(x) > >
plot(x,col="yellow")> polygon(x,col="blue") >
> plot(x,col="red") > polygon(x,col="yellow",border="green")
例2:
plot(c(1,9),1:2,type="n") > polygon(1:9,c(2,1,2,1,NA,2,1,2,1),density=c(10,10),angle=c(-45,45))