On Tue, May 5, 2009 at 8:58 AM, Greg Snow <greg.s...@imail.org> wrote:
> The function that is doing the color assignments is level.colors in the 
> lattice package.
> Looking at the code confirms that the number of colors should be 1 less than 
> the length
> of the at variable (the documentation implies that it should be 1 more, looks 
> like a documentation bug to me).

Could you point to the place where this is implied? I couldn't see
anything obviously wrong in ?levelplot or ?level.colors.

> It is possible that at one time the author intended to prepend -Inf and 
> append Inf to the at
> vector so that it did not need to span the entire range of the data, but that 
> was not implemented.
> I think I would prefer that fix to changing the documentation.

That is a slightly different issue though: e.g.,

> level.colors(c(1, 2, 3), at = c(1.5, 2.5, 3.5), colors = FALSE)
[1] NA  1  2

The first value doesn't fall in any interval, so gets a NA.

level.colors() is mainly a helper function for levelplot(), and it is
important there that the first and last intervals not be open-ended.
levelplot() has no 'zlim' argument, and you need 'at' to restrict the
values shown, e.g.,

levelplot(volcano, at = do.breaks(c(120, 200), 10))

-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