Re: [Rd] Question lattice SplomT

From: Deepayan Sarkar <deepayan.sarkar_at_r-project.org>
Date: Mon, 24 Sep 2012 22:30:38 +0530

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)

-Deepayan

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



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Mon 24 Sep 2012 - 17:04:18 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 24 Sep 2012 - 21:20:43 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive