On Wed, Dec 31, 2008 at 3:41 PM, Chris Poliquin <poliq...@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.

Reply via email to