[R] Padding in lattice plots

Deepayan Sarkar deepayan.sarkar at gmail.com
Tue Jul 19 18:50:00 CEST 2005


On 7/16/05, Federico Gherardini <f.gherardini at pigrecodata.net> wrote:
> On Friday 15 July 2005 17:00, Deepayan Sarkar wrote:
> > On 7/15/05, Federico Gherardini <f.gherardini at pigrecodata.net> wrote:
> > > On Friday 15 July 2005 14:42, you wrote:
> > > > Hi all,
> > > > I've used the split argument to print four lattice plots on a single
> > > > page. The problem now is that I need to reduce the amount of white
> > > > space between the plots. I've read other mails in this list about the
> > > > new trellis parameters layout.heights and layout.widhts but I haven't
> > > > been able to use them properly. I've tried to input values between 0
> > > > and 1 as the padding value (both left and right and top and bottom) but
> > > > nothing changed. It seems I can only increase the padding by using
> > > > values > 1. Any ideas?
> > > >
> > > > Thanks in advance for your help
> > > > Federico Gherardini
> > >
> > > It seems like I've found an answer myself.... you have to use negative
> > > values to decrease the padding. I thought it was something like the cex
> > > parameter which acts like a multiplier
> >
> > I thought so too.
> >
> > > but this is not the case.
> >
> > Could you post what you used? There are several different padding
> > parameters you need to set to 0, did you change them all?
> >
> > Deepayan
> 
> Hi Deepayan
> This is what I used.... I don't know if I did everything the "proper" way but
> at least I got the result I was seeking! :)
> 
> trellis.par.set(list(layout.heights = list(top.padding = -1)))
> 
> trellis.par.set(list(layout.heights = list(bottom.padding = -1,
> axis.xlab.padding = 1, xlab = -1.2)))
> 
> trellis.par.set(list(layout.widths = list(left.padding = -1)))
> 
> trellis.par.set(list(layout.widths = list(right.padding = -1,
> ylab.axis.padding = -0.5)))
> 
> Do these settings make any sense?

Yes, but there are other padding parameters. For example, at the top, there's 

 $ top.padding      : num 1
 $ main.key.padding : num 1
 $ key.axis.padding : num 1

The total amount of space left at the top (in the default case, with
no main label and no key) is the sum of all three, so just setting one
to 0 wouldn't be enough for what you want. (This is probably not very
simple, but I couldn't think of anything that's simpler yet as
flexible.)

Deepayan




More information about the R-help mailing list