[prev in list] [next in list] [prev in thread] [next in thread] 

List:       r-help
Subject:    Re: [R] Lattice trellis.focus() with pdf
From:       "Deepayan Sarkar" <deepayan.sarkar () gmail ! com>
Date:       2009-01-01 0:20:53
Message-ID: eb555e660812311620j2dd0b051j724dbfaed5e68988 () mail ! gmail ! com
[Download RAW message or body]

On Wed, Dec 31, 2008 at 3:41 PM, Chris Poliquin <poliquin@sas.upenn.edu> wrote:
> Hi,
>
> I have a the code for a plot that works perfectly running in R and printing
> to a Quartz object but which doesn't work when I make the trellis device a
> pdf.
>
> The code is as follows:
> ----
>
> trellis.device(device="pdf", new=TRUE)
> trellis.par.set(my.theme())
> dotplot(Y ~ X | C, groups=G, data=D, layout=c(2,1), ... )
>
> trellis.focus("panel", 1, 1)
> for (y in 1:5) {
>        panel.segments(...)
> }
> trellis.unfocus()
>
> trellis.focus("panel", 2, 1)
> for (y in 6:10) {
>        panel.segments(...)
> }
> trellis.unfocus()
>
> dev.off()
>
> ----
>
> The first for loop draws perfectly but the next panel never takes the focus
> and doesn't draw anything.  The resulting file has the red focus box around
> the first panel still when the commands finish.

Look more closely at your PDF file; it has more than one page.

"Removing" graphical objects in grid (the red box in this case) has
the effect of redrawing everything else in a new page. To avoid new
pages, you need to avoid such removal, which in this case is as easy
as

trellis.focus("panel", 1, 1, highlight = FALSE)

etc.

-Deepayan

______________________________________________
R-help@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.
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic