Re: [R] Lattice device page options-margins

From: Deepayan Sarkar <deepayan_at_stat.wisc.edu>
Date: Thu 10 Mar 2005 - 09:09:22 EST

On Wednesday 09 March 2005 13:54, Paul Murrell wrote:
> Hi
>
> Sundar Dorai-Raj wrote:
> > Bock, Michael wrote on 3/9/2005 1:19 PM:
> >> I am using lattice to make figures as pdfs:
> >> trellis.device(device = "pdf",file = "Figure6.pdf",color = FALSE)
> >>
> >> I need to specify some blank space on the left-hand margins (the
> >> pages will be bound so we need about 0.5 inch)). I have tried a
> >> number of solutions but none seems to work (e.g. par.set). Can
> >> this be done when initiating the plotting device? Or is the some
> >> other way that does not require me to manually move everything
> >> over?
> >
> > Michael,
> >
> > I believe you can do this using print.trellis and setting the
> > position argument. E.g.
> >
> > trellis.device(device = "pdf",file = "Figure6.pdf",color = FALSE)
> > xy <- xyplot(...)
> > print(xy, pos = c(0.10, 0, 1, 1))
> > dev.off()
>
> Or if you want exactly 0.5 inches, something like ...
>
> # may need
> # library(grid)
> trellis.device(device = "pdf",file = "Figure6.pdf",color = FALSE)
> xy <- xyplot(1:10 ~ 1:10)
> pushViewport(viewport(x=1,
> width=unit(1, "npc") - unit(0.5, "inches"),
> just="right"))
> # to show region you're plotting in
> # grid.rect(gp=gpar(col="grey"))
> print(xy, newpage=FALSE)
> popViewport()
> dev.off()

Yet another option, especially if you want this for multiple plots without having to handle each one separately, is to say (after loading lattice):

lattice.options(layout.widths = list(left.padding =

                list(x = 0.5, units = "inches")))

Unlike par settings though, this would stay in effect across devices.

Deepayan



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Mar 10 09:23:00 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:30:42 EST