Dear all I try to print 9 plots on a page, arranged as the code shows below. nf <- layout(matrix(c(1,0,2,0,0,3,0,4,0,5,0,6,0,0,0,0,7,0,8,9), 10,2)) layout.show(nf) but when I try to plot, an error message Fehler in plot.new() : Grafikr?nder zu gro? appears to verify p.e. with plot(runif(10:1)) i tried with plot(runif(10:1), ann=F) to produce more space, but neither. The second question: how to place a cross in the middle of the plot to delineate in 4 big fields (containing each 5 plots) Thanks a lot -- ______________________________________________ R-help at r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. --
I can't read what your error message, but on mine I get the error: "Error in plot.new(): margins too large", which is happening because the default margins do not have enough space. You can reduce the margins with using par par(mar=c(0,0,0,0)) Which will let plot.new() work. I hope this helps. Sam On 9/19/07, marcg <mdgi at gmx.ch> wrote:> Dear all > > I try to print 9 plots on a page, arranged as the code shows below. > > nf <- layout(matrix(c(1,0,2,0,0,3,0,4,0,5,0,6,0,0,0,0,7,0,8,9), 10,2)) > layout.show(nf) > > but when I try to plot, an error message > Fehler in plot.new() : Grafikr?nder zu gro? > appears > > to verify p.e. with > > plot(runif(10:1)) > > i tried with plot(runif(10:1), ann=F) to produce more space, but neither. > > The second question: how to place a cross in the middle of the plot to delineate in 4 big fields (containing each 5 plots) > > Thanks a lot > > > -- > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
Using ann=F just tells R not to put anything in the margins, it does not reduce the size of the margins. You need to reduce the margin size using par(mar= ...) with appropriate values. You can then shrink what goes in the margins rather than not plotting it at all (though that is a good first step to make sure everything else works). For adding the cross, look at the cnvrt.coords function in the TeachingDemos package, will that do what you want? (look at the examples) Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.snow at intermountainmail.org (801) 408-8111> -----Original Message----- > From: r-help-bounces at r-project.org > [mailto:r-help-bounces at r-project.org] On Behalf Of marcg > Sent: Wednesday, September 19, 2007 5:26 AM > To: r-help at stat.math.ethz.ch > Subject: [R] layout function for several plots > > Dear all > > I try to print 9 plots on a page, arranged as the code shows below. > > nf <- layout(matrix(c(1,0,2,0,0,3,0,4,0,5,0,6,0,0,0,0,7,0,8,9), 10,2)) > layout.show(nf) > > but when I try to plot, an error message Fehler in plot.new() > : Grafikr?nder zu gro? appears > > to verify p.e. with > > plot(runif(10:1)) > > i tried with plot(runif(10:1), ann=F) to produce more space, > but neither. > > The second question: how to place a cross in the middle of > the plot to delineate in 4 big fields (containing each 5 plots) > > Thanks a lot > > > -- > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > -- > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
On Wed, 19 Sep 2007, Greg Snow wrote:> Using ann=F just tells R not to put anything in the margins, it does not > reduce the size of the margins. You need to reduce the margin size > using par(mar= ...) with appropriate values. You can then shrink what > goes in the margins rather than not plotting it at all (though that is a > good first step to make sure everything else works).However, if you try to plot 9 plots on one device surface, you almost certainly need to reduce the pointsize. par(mfrow=) does that automatically, but layout() does not. If the device you are using does not support pointsize, try a global setting of cex. You could also increase the device dimensions, but other settings (e.g. the default line width) will not be appropriate unless the intention is to zoom in on individual plots. a -- 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 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595