I am trying to produce a postscript plot consisting of rectangles and text labels in R. It is going very well, but I have been unable to get small margins on the page. I read the documentation on the 'mar' and 'oma' options, but they claim that the margins should default to being 0.25in wide, in fact on my plot they are more like 1in each! Here is the smallest R script that illustrates my problem: postscript ( "janos.ps", paper="letter" ) plot.new() rect ( 0, 0, 1, 1, col="yellow", border=0 ) dev.off() Could you kindly suggest an extra command (or two) to insert, which would make the margins very small? Please drop a copy of your reply to my email address, janos at research.att.com Thanks, Janos A Csirik. PS. I am using version 1.1.1 on a Linux box. -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
On Sun, 26 Nov 2000, Janos A. Csirik wrote:> I am trying to produce a postscript plot consisting of rectangles and text > labels in R. It is going very well, but I have been unable to get small > margins on the page. I read the documentation on the 'mar' and 'oma' > options, but they claim that the margins should default to being 0.25in > wide, in fact on my plot they are more like 1in each! Here is theWhich margins? The margins of the postscript device region are 0.25in around the edge of the paper. There are two more margins: see R-intro. 'mar' sets the margins of the plot within a figure, and 'oma' the margins of the figure within the devion region.> smallest R script that illustrates my problem: > > postscript ( "janos.ps", paper="letter" )add par(mar=rep(0,4))> plot.new() > rect ( 0, 0, 1, 1, col="yellow", border=0 ) > dev.off() > > Could you kindly suggest an extra command (or two) to insert, which would > make the margins very small? Please drop a copy of your reply to my email > address, janos at research.att.comThe device region (in big points) is 18 18 594 774, and that's also the figure region. HOWEVER, you have not set a coordinate system, and by default that has a 4% margin. Try postscript ( "janos.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="yellow", border=0 ) dev.off() Using plot.new from user code is almost always a mistake. If you don't want the paper margins then you probably do not want to print, and you should set paper="special" and width and height in the postscript call. -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hello, 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. Please send a copy of your reply to janos at research.att.com Thanks again, Janos A Csirik -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Hi> 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 border=NULL. 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. Paul -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
You want to use "lwd=0" rather than "border=0". "border" sets the border _color_, not its width (and border=0, I believe, sets the border to the current background color, white in this case). A more careful reading of ?rect would have detected this ... Ben Bolker On Tue, 28 Nov 2000, Janos A. Csirik wrote:> Hello, > > 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. > > Please send a copy of your reply to janos at research.att.com > > Thanks again, > > Janos A Csirik > > > -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > 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 > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- 318 Carr Hall bolker at zoo.ufl.edu Zoology Department, University of Florida http://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- 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 _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._