[R] Strange behaviour

Prof Brian Ripley ripley at stats.ox.ac.uk
Tue Oct 21 14:14:37 CEST 2003


On Tue, 21 Oct 2003, Vittorio wrote:

> Paul Murrell [r-help] <20/10/03 09:13 +1300>:
> > Hi
> >..................................................... 
> > The "nasty rectangles" are the output of the layout.show() function. 
> > This function draws a simple diagram (consisting of nasty rectangles) to 
> > indicate the regions that a call to layout() has set up.  It is designed 
> > to help users to understand what on earth the layout() function is 
> > doing.  (It is NOT a necessary part of setting up an arrangement of 
> > plots using the layout() function.)
> > 
> > I suspect that the author of "simpleR" may have accidentally left the 
> > layout.show() call in simple.scatterplot() when copying the example from 
> > the layout() help file (apologies to John Verzani if this is an unfair 
> > diagnosis).
> > 
> > So the immediate solution to your problem is to remove the line ...
> > 
> >     layout.show(nf)
> > 
> > ... from simple.scatterplot().  The output should then be a single page 
> > which should "include" ok in latex.
> > 
> > The larger problem of how to get at individual pages of output is 
> > probably best solved using something like the "onefile" argument to 
> > devices.  For example, look at the files produced by ...
> > 
> >     pdf(onefile=FALSE)
> >     example(layout)
> > 
> > ... and at the help page for pdf() to see more about how to do this.
> > 
> > Hope that helps
> >...............................
> 
> Yes, Paul, definitely it helps. Thanks!
> 
> I obtained what I wanted. 
> 
> Now, I want to control the output of the pdf() command making it write
> a specific file chosen by me and not the system. After reading the
> help page for the pdf, I was unable to do it.
> 
> E.g. I issued
>  
> onefile<-FALSE
> pdf(file=ifelse(onefile,,"vic.pdf")
That's an error: it has a missing argument and a missing parenthesis.
> example(layout)

Note:

1) onefile is no longer set as an argument to pdf().

2) When you set onefile=FALSE, you will only get the last plot in your
file unless you give a file name of the type described on the help page.

3) *You* plotted the `nasty rectangles', so why are you aruprised you got 
them in the file?  If you don't want them, don't plot them!

> And I obtained a 5-pages vic.pdf with page 1-4 full of "nasty
> rectangles" of any kind and page 5 with the right picture.
> 
> Please help

Please follow more carefully the help you have already been given.

-- 
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




More information about the R-help mailing list