[R] R rectangle boundary question

Paul Murrell paul at stat.auckland.ac.nz
Tue Nov 28 23:18:14 CET 2000


> I am trying to produce two rectangles in R that are immediately adjacent
> to each other.  However, I always seem to get a white boundary around each
> rectangle, even though I have border=0.  Can anyone tell me how to get rid
> of that boundary?  Thanks!
> Here is a script of minimal length that illustrates my problem:
> -------------------------------------------------------------------
> postscript ( "out.ps", paper="letter" )
> par(mar=rep(0,4))
> plot(c(0,1), c(0,1), type="n", xaxs="i", yaxs="i", bty="n")
> rect ( 0,0,1,1, col="white", border=0 )
> rect ( 0.1, 0.1, 0.9, 0.9, col="darkgreen", border=0 )
> rect ( 0.2, 0.2, 0.8, 0.8, col="yellow", border=0 )
> dev.off()
> -------------------------------------------------------------------
> If you look at the output, you see that the yellow rectangle is surrounded
> by a tiny white boundary, instead of the color going immediately from
> yellow to green.

Setting border=0 means draw the border in colour "0" (which happens to be
white in this case).  If you do not want the border to be drawn, use

This is hinted at in help(rect) with the default setting of col=NULL (which
does not fill the rect),
but we should probably document this more clearly.


r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch

More information about the R-help mailing list