[Rd] Question lattice SplomT

Deepayan Sarkar deepayan.sarkar at r-project.org
Mon Sep 24 19:00:38 CEST 2012

On Mon, Sep 24, 2012 at 9:22 PM, Christian Hoffmann
<c-w.hoffmann at sunrise.ch> wrote:
> Dear Deepayan Sarkar,
> I have (again) a question concerning "panel" and my function "SplomT", see
> attachments. Some time ago you helped me to write this function, thanks
> again. I have used it to great advantage in my statistics instructions. Now
> the problem I encounter is that the .pdf figure generated in Sweave consists
> of
> one extra empty page at the start.

This seems to be due to the get.gpar() call in the SplomT() function
-- it produces a new page if it is called before any graphics output
is drawn.

That's not quite correct: The point is that grid.newpage() does some
magic to NOT create a new page if it realizes that it is being called
with a fresh device with nothing drawn on it yet. Calling get.gpar()
is enough to make that magic fail, so the grid.newpage() call inside
print.trellis() is actually creating a new page.

Your options are:

(1) get rid of the get.gpar()$cex call (can it be anything other than
1 on a new device?), or

(2) call print(splom(...), newpage=FALSE)


> This prevents it from showing up in the final .pdf document. I am not sure
> whether this has any thing to do with Sweave. (If the statement is executed
> on the command line, the plot in the Quartz window looks allright.)
> Since I have no full version of Adobe Acrobat I cannot eliminate the empty
> first page. I tried to fiddle around with the panel functions, but was not
> table to mimic my function.
> Thanks for your attention and for looking at my problem.
> Christian Hoffmann
> PS: for *r-devel*: Could this be an Sweave problem?
> Files attached:
> SplomT.Rnw  : File containing the Functiond and an example,
> SplomT.tex   : Result from Sweave of .Rnw,
> SplomT.pdf  : Result from TeXing the .tex,
> Fig_A.pdf    : Resulting figure from Sweave
> SplomT.png  : Screenshot of Fig_A.pdf
> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
> locale:
> [1] C
> attached base packages:
>  [1] tools     tcltk     stats4    splines   parallel  datasets compiler
>  [8] graphics  grDevices stats     grid      utils     methods base
> other attached packages:
>  [1] survival_2.36-14  spatial_7.3-3     rpart_3.1-53 nnet_7.3-1
>  [5] nlme_3.1-104      mgcv_1.7-18       foreign_0.8-50 codetools_0.2-8
>  [9] cluster_1.14.2    class_7.3-3       boot_1.3-4 Matrix_1.0-6
> [13] MASS_7.3-18       KernSmooth_2.23-7 cwhmisc_3.0 lattice_0.20-6
> --
> Christian W. Hoffmann,
> CH - 8915 Hausen am Albis, Switzerland
> Rigiblickstrasse 15 b, Tel.+41-44-7640853
> c-w.hoffmann at sunrise.ch,
> christian at echoffmann.ch,
> www.echoffmann.ch

More information about the R-devel mailing list