[R] Spacing between lattice panels

Richard.Cotton at hsl.gov.uk Richard.Cotton at hsl.gov.uk
Tue May 6 14:23:31 CEST 2008


I'm trying to set up a lattice plot with two y-axes for each panel.  (Yes, 
I know that multiple y-axes are generally a bad idea; the graph is for 
someone else and they want it that way.)  I've used a custom 
yscale.component in xyplot to achieve this:

myyscale.component <- function(...)
{
  ans <- yscale.components.default(...)
  ans$right <- ans$left
  foo <- ans$right$labels$at
  ans$right$labels$labels <- as.character(10*foo)
  ans 
}

xyplot(Sepal.Length ~ Petal.Length| Species, data = iris, scales = 
list(y=list(relation="free", alternating=3, rot=0)), 
yscale.component=myyscale.component)
 
The problem is that the panels are too close together.  This appears to be 
because (according to the help documentation) xyplot ignores the 
alternating argument when relation is not "same".  I presume that manually 
setting some plotting parameters with trellis.par.set() will allow me to 
adjust the spacing between the panels, though I can't figure out which 
ones to change.

Is there a way to get lattice to properly space the panels, or failing 
that, how do I manually space them?

Regards,
Richie.

Mathematical Sciences Unit
HSL


------------------------------------------------------------------------
ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}



More information about the R-help mailing list