How do I specify a "tight" y-axis, where the plot completely fills the
y-axis range, inside the prepanel function? For example, consider the
following code:

require(lattice)

set.seed(12345)
x <- 1:1000
y <- cumsum(rnorm(length(x)))


prepanel.test <- function(x, y, groups = NULL, subscripts = NULL, ...) {

  if (is.null(groups)) {
    result <- list(ylim = range(y))
  } else {
    result <- list(ylim = range(y, finite = TRUE))
  }

  return (result)

}

print(xyplot(y~x, prepanel = prepanel.test, type = 'l', grid = TRUE), split
= c(1,1,1,2), more = TRUE)
print(xyplot(y~x, ylim = range(y, finite = TRUE), type = 'l', grid = TRUE),
split = c(1,2,1,2))

The top plot has extra whitespace at the top and bottom. Is there any way
to eliminate this without having to specify 'ylim' directly in the call the
'xyplot'? (The reason I want to include this in the prepanel function is
that I want to add conditioning and use the "combineLimits" function in the
latticeExtra package.)

Thanks.

- Elliot

        [[alternative HTML version deleted]]

______________________________________________
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