[R] levelplot question
deepayan.sarkar at gmail.com
Thu May 7 02:35:08 CEST 2009
On Tue, May 5, 2009 at 8:58 AM, Greg Snow <Greg.Snow at 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)
 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))
More information about the R-help